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 24A6DDB48 for ; Sun, 20 Jan 2013 21:40:32 +0000 (UTC) Received: (qmail 40994 invoked by uid 500); 20 Jan 2013 21:40:30 -0000 Delivered-To: apmail-maven-users-archive@maven.apache.org Received: (qmail 40941 invoked by uid 500); 20 Jan 2013 21:40:29 -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 40933 invoked by uid 99); 20 Jan 2013 21:40:29 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Jan 2013 21:40:29 +0000 Received: from localhost (HELO columbia) (127.0.0.1) (smtp-auth username rfscholte, mechanism login) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Jan 2013 21:40:29 +0000 Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes To: "Maven Users List" Subject: Re: Maven Plugin Issue - MavenProject Not Bound References: Date: Sun, 20 Jan 2013 22:40:27 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Robert Scholte" Message-ID: In-Reply-To: User-Agent: Opera Mail/12.12 (Win32) When using doclet-tags, you should use: @parameter default-value="${project}" Robert Op Sun, 20 Jan 2013 22:34:31 +0100 schreef Jeremy Long : > I am trying to create a simple plugin to inspect project dependencies > using > the MavenProject - but I'm getting an error because the MavenProject is > not > bound (see below for details). > > Here is the code for the plugin: > > /** > * Goal that checks project dependencies > * @goal package > * @phase package > * @requiresProject false > * @requiresDependencyResolution runtime > * @requiresOnline true > * @execute phase="package" > */ > public class DependencyCheckMojo extends AbstractMojo { > > /** > * POM > * > * @component > */ > protected MavenProject project; > > public void execute() throws MojoExecutionException { > if (project != null) { > Set artifacts = project.getArtifacts(); > for (Artifact a : artifacts) { > getLog().error(a.getFile().toString()); > } > } else { > getLog().error("Dependency Check - Maven project is null"); > } > } > } > > The POM for the plugin is: > > .... > org.codesecure > DependencyCheck-Plugin > 1.0-SNAPSHOT > maven-plugin > > > > > maven-plugin-plugin > 2.3 > > dependencycheck > > > > mojo-descriptor > > descriptor > > > > > > > > > org.apache.maven > maven-plugin-api > 3.0 > > > org.apache.maven > maven-core > 3.0 > > .... > > > However, when I use this plugin in another project: > > > org.codesecure > DependencyCheck-Plugin > 1.0-SNAPSHOT > > > package > > package > > > > > > And I run 'mvn package' I get the following error: > > [ERROR] Failed to execute goal > org.codesecure:DependencyCheck-Plugin:1.0-SNAPSHO > T:package (default) on project sample: Execution default of goal > org.codesecure: > DependencyCheck-Plugin:1.0-SNAPSHOT:package failed: Unable to load the > mojo > 'pac > kage' (or one of its required components) from the plugin > 'org.codesecure:Depend > encyCheck-Plugin:1.0-SNAPSHOT': com.google.inject.ProvisionException: > Guice > prov > ision errors: > [ERROR] > [ERROR] 1) No implementation for org.apache.maven.project.MavenProject > was > bound > . > [ERROR] while locating org.codesecure.DependencyCheckMojo > > > Any idea what I'm doing wrong? > > Thanks in advance, > > Jeremy --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org For additional commands, e-mail: users-help@maven.apache.org