You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Lewis, Eric" <Er...@ipi.ch> on 2009/09/30 16:27:54 UTC

Get dependencies in generate-sources phase?

Hi

I'm trying to access my project's classpath in a plugin I'm writing, which should generate JPA's persistence.xml file from JPA entities found on the classpath.
To work, this should run during the generate-sources phase, but do I have access to the projects dependencies (transivite dependencies, if possible) at that point?

Best regards,
Eric

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


AW: Get dependencies in generate-sources phase?

Posted by "Lewis, Eric" <Er...@ipi.ch>.
Thanks, works well!

Best regards,
Eric 

> -----Ursprüngliche Nachricht-----
> Von: Tony Chemit [mailto:chemit@codelutin.com] 
> Gesendet: Mittwoch, 30. September 2009 16:43
> An: users@maven.apache.org
> Betreff: Re: Get dependencies in generate-sources phase?
> 
> Le Wed, 30 Sep 2009 16:27:54 +0200,
> "Lewis, Eric" <Er...@ipi.ch> a écrit :
> 
> > Hi
> > 
> > I'm trying to access my project's classpath in a plugin I'm 
> writing, which
> > should generate JPA's persistence.xml file from JPA 
> entities found on the
> > classpath. To work, this should run during the 
> generate-sources phase, but do
> > I have access to the projects dependencies (transivite 
> dependencies, if
> > possible) at that point?
> > 
> > Best regards,
> > Eric
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> 
> You can use the annotation @requiresDependencyResolution 
> <compile|runtime|test> [0] on your mojo
> 
> Then you should be able to access the project dependencies
> 
> 
> [0] 
> http://www.sonatype.com/books/maven-book/reference/writing-plu
> gins-sect-class-annotations.html 
> -- 
> 
> Tony Chemit
> --------------------
> tél: +33 (0) 2 40 50 29 28
> email: chemit@codelutin.com  
> http://www.codelutin.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Get dependencies in generate-sources phase?

Posted by Tony Chemit <ch...@codelutin.com>.
Le Wed, 30 Sep 2009 16:27:54 +0200,
"Lewis, Eric" <Er...@ipi.ch> a écrit :

> Hi
> 
> I'm trying to access my project's classpath in a plugin I'm writing, which
> should generate JPA's persistence.xml file from JPA entities found on the
> classpath. To work, this should run during the generate-sources phase, but do
> I have access to the projects dependencies (transivite dependencies, if
> possible) at that point?
> 
> Best regards,
> Eric
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

You can use the annotation @requiresDependencyResolution <compile|runtime|test> [0] on your mojo

Then you should be able to access the project dependencies


[0] http://www.sonatype.com/books/maven-book/reference/writing-plugins-sect-class-annotations.html 
-- 

Tony Chemit
--------------------
tél: +33 (0) 2 40 50 29 28
email: chemit@codelutin.com  
http://www.codelutin.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org