Return-Path: X-Original-To: apmail-maven-users-archive@www.apache.org Delivered-To: apmail-maven-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1E0F610E37 for ; Tue, 11 Feb 2014 21:42:02 +0000 (UTC) Received: (qmail 74094 invoked by uid 500); 11 Feb 2014 21:41:57 -0000 Delivered-To: apmail-maven-users-archive@maven.apache.org Received: (qmail 73962 invoked by uid 500); 11 Feb 2014 21:41:57 -0000 Mailing-List: contact users-help@maven.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Maven Users List" Reply-To: "Maven Users List" Delivered-To: mailing list users@maven.apache.org Received: (qmail 73950 invoked by uid 99); 11 Feb 2014 21:41:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Feb 2014 21:41:56 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of baerrach@gmail.com designates 209.85.212.41 as permitted sender) Received: from [209.85.212.41] (HELO mail-vb0-f41.google.com) (209.85.212.41) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Feb 2014 21:41:50 +0000 Received: by mail-vb0-f41.google.com with SMTP id g10so6351502vbg.14 for ; Tue, 11 Feb 2014 13:41:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=HltpLxuzvAbvf0e0PSIogluvuX+HfhKWD5AApPeGTqc=; b=PJjLoQ9Wcc7CvT0K+QNXUAoerevxIh095piLPFOyAPfZtc1MaaVqGTrDL4H8RO5lHb DyV3OvnSldIkyWMmk0gM68e0Jh0WhrmlyzlrrbWt5z3pKAMs2vYkz7GQ+UL/DhG226ho LbDWVw2+85ggGB2Eom01VmdFbhAxu55m1i+8ghT50nJQGdXl5oGvUBI1lTE1EpEXpTXa HrsTOrJ1yzuvr5gH81VMAzczH8SsuZ8P9k5qytUIdrauAdqjaTMqh/WlSA91XjqF9WV/ YcmedG8Udgl53mzM6C0f5WzjmeyktknakN2rFw3R3HKKY+lKfBx1qkcgx+/JmwPLjI9H pliA== MIME-Version: 1.0 X-Received: by 10.58.66.137 with SMTP id f9mr29749411vet.11.1392154889697; Tue, 11 Feb 2014 13:41:29 -0800 (PST) Received: by 10.58.48.131 with HTTP; Tue, 11 Feb 2014 13:41:29 -0800 (PST) In-Reply-To: <1392153066705-5784108.post@n5.nabble.com> References: <1392153066705-5784108.post@n5.nabble.com> Date: Wed, 12 Feb 2014 08:11:29 +1030 Message-ID: Subject: Re: Why is dependency:analyze lying to me? From: Barrie Treloar To: Maven Users List Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org On 12 February 2014 07:41, laredotornado-3 wrote: > Hi, > > I'm using Maven 3.1.1 on Mac 10.9.1. When I ran "mvn dependency:analyze" on > my project, I got results that included: > > [WARNING] Unused declared dependencies found: > ... > [WARNING] junit:junit:jar:4.11:test > > So I commented out the above junit dependency in my pom (declared like so): [del] > java.lang.NoSuchFieldError: NULL > at org.junit.runners.ParentRunner.(ParentRunner.java:48) > at > org.junit.runners.BlockJUnit4ClassRunner.(BlockJUnit4ClassRunner.java:58) > at > org.springframework.test.context.junit4.SpringJUnit4ClassRunner.(SpringJUnit4ClassRunner.java:104) > > This isn't the only dependency that the analyze goal lists that wreaks havoc > when I comment it out. Is there another way to detect what dependencies are > truly not needed by my project? Unfortunately this stuff is not documented well enough in the plugin. You're welcome to submit a patch! Have a look at http://maven.apache.org/plugins/maven-dependency-plugin/faq.html#unused I think Maven is missing a scope, it needs to break up test into two phases; testCompile and testRuntime instead of having one scope which means both. This means that the analyze code can't tell what stuff is needed for tests at compile time and what is needed at runtime. If my memory serves me right, that would mean for your example that Spring is a compile time dependency but junit would be a runtime dependency. Hence the incorrect "Unused declared dependencies found" error. I would manually ignore anything found in the test scope from the error list. I never found the time to go hacking the plugin to work better - i.e. if it is test scope it really can't tell the difference between unused dependencies and shouldn't report them. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org For additional commands, e-mail: users-help@maven.apache.org