You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mike Olson <Mi...@Sun.COM> on 2009/12/07 23:29:55 UTC
Issues with plugin dependencies
Hello,
This is with Maven 2.2.1.
I have an aggregate POM file that contains 2 child projects, say
project A and project B.
Each of these child projects uses a custom build plugin. Project A
calls it like
<build>
<plugins>
<plugin>
<groupId>myGrupId</groupId>
<artifactId>myArtifactId</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>my-dep-1-group</groupId>
<artifactId>my-dep-1-artifactId</artifactId>
<version>my-dep-1-version</version>
<classifier>data</classifier>
<scope>compile</scope>
</dependency>
</dependencies>
<configuration>
<myParam1>param</myParam1>
</configuration>
<executions>
<execution>
<id>EXEC1</id>
<phase>generate-sources</phase>
<goals>
<goal>generate-code</goal>
</goals>
<configuration>
<p2>param2<//p2>
</configuration>
</execution>
</executions>
<plugin>
</plugins>
</build>
Basically it invokes a custom MOJO in the generate-sources phase. The
plugin uses information on the classpath (among other things) to
determine what code to generate.
Child project 2 has the exact same setup "however" it changes the
dependency defined in the plugin to be dependent on a different project.
When I build each project individually, they build perfectly fine.
However, when I build the aggregate project, child project 2 fails
because it is using the dependencies of the first project. I have
verified this with various dumps of the class path, etc. I have tried
inheriting the plugin information, separate plugin definitions in the
child project, many configurations. It always seems that the first time
a plugin is loaded that is the classpath used for that plugin whenever
it is executed.
Is this a bug? I would have expected the inline dependencies to work
just like the configuration section of a plugin, basically it is for
that invocation only.
If this is not a bug, how should I be invoking the same plugin twice,
with different class paths, within the same build.
Thank
Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Issues with plugin dependencies
Posted by Anders Hammar <an...@hammar.net>.
I haven't run into this use case, but I would think it should work. Have you
tried other Maven versions like 2.0.x? Also, I would strongly suggest you
try out 3.0-alpha-5. My experience is that errors that I've run into with
the 2.x code is fixed in 3.0.
/Anders
On Mon, Dec 7, 2009 at 23:29, Mike Olson <Mi...@sun.com> wrote:
>
> Hello,
>
> This is with Maven 2.2.1.
>
> I have an aggregate POM file that contains 2 child projects, say project A
> and project B.
>
> Each of these child projects uses a custom build plugin. Project A calls
> it like
>
> <build>
> <plugins>
> <plugin>
> <groupId>myGrupId</groupId>
> <artifactId>myArtifactId</artifactId>
> <version>1.0</version>
> <dependencies>
> <dependency>
> <groupId>my-dep-1-group</groupId>
> <artifactId>my-dep-1-artifactId</artifactId>
> <version>my-dep-1-version</version>
> <classifier>data</classifier>
> <scope>compile</scope>
> </dependency>
> </dependencies>
> <configuration>
> <myParam1>param</myParam1>
> </configuration>
> <executions>
> <execution>
> <id>EXEC1</id>
> <phase>generate-sources</phase>
> <goals>
> <goal>generate-code</goal>
> </goals>
> <configuration>
> <p2>param2<//p2>
> </configuration>
> </execution>
> </executions>
> <plugin>
> </plugins>
> </build>
>
> Basically it invokes a custom MOJO in the generate-sources phase. The
> plugin uses information on the classpath (among other things) to determine
> what code to generate.
>
> Child project 2 has the exact same setup "however" it changes the
> dependency defined in the plugin to be dependent on a different project.
>
> When I build each project individually, they build perfectly fine.
> However, when I build the aggregate project, child project 2 fails because
> it is using the dependencies of the first project. I have verified this
> with various dumps of the class path, etc. I have tried inheriting the
> plugin information, separate plugin definitions in the child project, many
> configurations. It always seems that the first time a plugin is loaded that
> is the classpath used for that plugin whenever it is executed.
>
> Is this a bug? I would have expected the inline dependencies to work just
> like the configuration section of a plugin, basically it is for that
> invocation only.
>
> If this is not a bug, how should I be invoking the same plugin twice, with
> different class paths, within the same build.
>
> Thank
> Mike
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Issues with plugin dependencies
Posted by Anders Hammar <an...@hammar.net>.
We are all mortals...:-)
However, it looks like it has been fixed in 3.0-alpha-1. Mike, try
3.0-alpha-5! When you've tried it, there is no going back...:-)
http://www.sonatype.com/people/2009/11/maven-30-new-and-improved-formula/
/Anders
On Tue, Dec 8, 2009 at 06:55, Wayne Fay <wa...@gmail.com> wrote:
> > Child project 2 has the exact same setup "however" it changes the
> dependency
> > defined in the plugin to be dependent on a different project.
> >
> > configurations. It always seems that the first time a plugin is loaded
> that
> > is the classpath used for that plugin whenever it is executed.
>
> This is a (very well) known bug in Maven 2. The "first" declaration of
> a plugin's dependencies "wins" (as plugin containers are initialized
> once per build) so you need to include all dependencies for all uses
> of a given plugin in the "first" declaration. See JIRA:
> http://jira.codehaus.org/browse/MNG-1949
>
> I'm actually surprised Anders didn't know this one... ;-)
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Issues with plugin dependencies
Posted by Wayne Fay <wa...@gmail.com>.
> Child project 2 has the exact same setup "however" it changes the dependency
> defined in the plugin to be dependent on a different project.
>
> configurations. It always seems that the first time a plugin is loaded that
> is the classpath used for that plugin whenever it is executed.
This is a (very well) known bug in Maven 2. The "first" declaration of
a plugin's dependencies "wins" (as plugin containers are initialized
once per build) so you need to include all dependencies for all uses
of a given plugin in the "first" declaration. See JIRA:
http://jira.codehaus.org/browse/MNG-1949
I'm actually surprised Anders didn't know this one... ;-)
Wayne
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org