Adding @requiresProject does nothing. Interestingly, I'm getting the dependencies just fine without having @requiresDependencyResolution there (although in my case I don't want transitive dependencies--I expected leaving this attribute out would only give me the direct dependencies including inherited dependencies).
Anyway, I think I've found the problem with project.properties showing up empty in the plugin. The problem is in the Plexus code. I will post my findings in a separate email. ..David.. -----Original Message----- From: Marcos Silva Pereira [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 21, 2007 11:02 PM To: Maven Users List Subject: Re: Mojo accessing project properties Hi, you need annotate you mojo with @requiresProject tag: /** * Verifies that the dependencies of the project are official. * * @goal verify * * @phase validate * @requiresProject * @requiresDependencyResolution */ public class VerifyDependenciesMojo extends AbstractMojo { ... } So, maven will do all stuff that is necessary to parse pom and create MavenProject object before start your mojo. Because you need to access dependencies project, you also need to use the @requiresDependencyResolution. Hope this helps. On 2/17/07, David Jackman <[EMAIL PROTECTED]> wrote: > > At this point, it's a simple mojo that I'm executing via the command > line (trying to figure out how I can get at this information and what > form it comes in since no docs explain this). This mojo will > eventually be attached to the verify phase, and that's what's in the > mojo now. Are the properties not available at that stage? The entire mojo code is below. > > ..David.. > > > /** > * Verifies that the dependencies of the project are official. > * > * @goal verify > * > * @phase validate > */ > public class VerifyDependenciesMojo extends AbstractMojo { > /** > * Dependencies to verify. > * Items in the list will be of type > org.apache.maven.model.Dependency . > * > * @parameter default-value="${project.dependencies}" > * @required > * @readonly > */ > private List dependencies; > > /** > * Project properties. > * > * @parameter default-value="${project.properties}" > * @required > * @readonly > */ > private Properties properties; > > /** > * @see AbstractMojo#execute() > */ > public void execute() throws MojoExecutionException, > MojoFailureException > { > getLog().debug("Properties: " + properties); > } > } > > > ________________________________ > > From: Jason van Zyl [mailto:[EMAIL PROTECTED] > Sent: Fri 2/16/2007 8:38 PM > To: Maven Users List > Subject: Re: Mojo accessing project properties > > > > What's the rest of your mojo look like? > > Are you using @execute phase="something"? > > Jason. > > On 16 Feb 07, at 4:43 PM 16 Feb 07, David Jackman wrote: > > > I'm trying to write a mojo that accesses the properties section of > > the project pom. I declared a member variable like this > > /** > > * Project properties. > > * > > * @parameter default-value="${project.properties}" > > * @required > > * @readonly > > */ > > private Properties properties; > > When my mojo runs, it gets a Properties object okay, but it's always > > empty, even if I have declared properties in the project POM. > > > > Am I doing something wrong? How do I access the project properties > > (not plugin configuration properties)? > > > > ..David.. > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- Marcos Silva Pereira recife - pe [EMAIL PROTECTED] skype: marcos.silva.pereira http://blastemica.blogspot.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]