You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by fmeili <fr...@itac.de> on 2011/01/10 15:17:39 UTC
project.getArtifacts() difference between maven 2 and maven 3 in
plugin
Hi,
I've some problems while migrating my projects and plugins from maven 2.2.1
to maven 3.0.1. My self developed plugin does not longer work with maven 3.
My plugin needs all dependend artifacts (includeing transitives) of the
project. With maven 2.2.1 the call to project.getArtifacts() works correct.
When using it with maven 3.0.1 the returned set of artifacts for a project
has a size of zero.
Code snippets:
/**
* @goal myGoal
* @phase package
* @inheritByDefault false
* @threadSafe
*/
public class MyEar extends AbstractMojo {
...
/**
* @parameter default-value="${project}"
* @required
* @readonly
*/
protected MavenProject project;
...
Set artifacts = project.getArtifacts(); // set is empty in maven 3 but ok in
maven 2
I played with the javadoc class annotation "@requiresDependencyResolution
compile" but this produce wrong results for maven 2 and also didn't change
anything for maven 3, it's still an empty set.
Has someone an idea what's wrong with my code?
Thanks in advance,
Frank
--
View this message in context: http://maven.40175.n5.nabble.com/project-getArtifacts-difference-between-maven-2-and-maven-3-in-plugin-tp3334878p3334878.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: project.getArtifacts() difference between maven 2 and maven 3
in plugin
Posted by fmeili <fr...@itac.de>.
thanks a lot Benjamin,
after setting "@requiresDependencyResolution runitme" it works with maven 2
and maven 3. When using "compile" as an option it didn't work.
Greetings,
Frank
--
View this message in context: http://maven.40175.n5.nabble.com/project-getArtifacts-difference-between-maven-2-and-maven-3-in-plugin-tp3334878p3335168.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: project.getArtifacts() difference between maven 2 and maven 3
in plugin
Posted by Benjamin Bentmann <be...@udo.edu>.
fmeili wrote:
> My plugin needs all dependend artifacts (includeing transitives) of the
> project. With maven 2.2.1 the call to project.getArtifacts() works correct.
> When using it with maven 3.0.1 the returned set of artifacts for a project
> has a size of zero.
>
> Code snippets:
>
> /**
> * @goal myGoal
> * @phase package
> * @inheritByDefault false
> * @threadSafe
> */
> public class MyEar extends AbstractMojo {
> ...
> /**
> * @parameter default-value="${project}"
> * @required
> * @readonly
> */
> protected MavenProject project;
> ...
> Set artifacts = project.getArtifacts(); // set is empty in maven 3 but ok in
> maven 2
>
>
> I played with the javadoc class annotation "@requiresDependencyResolution
You need this annotation, whether you request compile, runtime or test
classpath is a choice you need to make.
Plugins accessing dependencies without this annotation produce random
results in Maven 2 depending on which plugins ran before.
Benjamin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org