Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
1.3
-
None
-
None
-
maven 2.0.6
Description
[This is perhaps a maven 2.0.6 issue.]
pom.xml
module/pom.xml
module/pom.xml contains (in a profile enabled by default) an antrun plugin configuration with specific dependencies. The antrun plugin tasks tries to load a custom task (abator) found under the maven.plugin.classpath. This fails if I build from the root when I specify the antrun plugin version in the root POM: the plugin classpath lacks the dependencies. It doesn't fail if I build from the module itself.
Something similar to:
<profiles>
<profile>
<id>gen-from-db</id>
<activation>
<property>
<name>!gen.skip</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<tasks>
<property name="plugin_classpath" refid="maven.plugin.classpath"/>
<echo message="plugin classpath: ${plugin_classpath}"/>
[...]
<taskdef name="abator"
classname="org.apache.ibatis.abator.ant.AbatorAntTask"
classpath="${plugin_classpath}"/>
<abator ... />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ibatis.abator</groupId>
<artifactId>abator</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.3.0</version>
</dependency>
</dependencies>
</plugin>
If I build from the module or if I remove the versioning definition in the root POM, I get:
[echo] plugin classpath: /home/jerome/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar:/home/jerome/.m2/repository/org/apache/ibatis/abator/abator/1.0.0_edb_1/abator-1.0.0_edb_1.jar:/home/jerome/.m2/repository/org/apache/ant/ant-launcher/1.7.1/ant-launcher-1.7.1.jar:/home/jerome/.m2/repository/com/oracle/ojdbc14/10.2.0.3.0/ojdbc14-10.2.0.3.0.jar:/home/jerome/.m2/repository/org/apache/ant/ant/1.7.1/ant-1.7.1.jar:/usr/local/lib/maven-2.0.6/lib/maven-core-2.0.6-uber.jar
which works.
If in the root pom.xml, I define the version of the antrun plugin under <build><plugins>, the plugin classpath is:
[echo] plugin classpath: /home/jerome/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar:/home/jerome/.m2/repository/org/apache/ant/ant-launcher/1.7.1/ant-launcher-1.7.1.jar:/home/jerome/.m2/repository/org/apache/ant/ant/1.7.1/ant-1.7.1.jar:/usr/local/lib/maven-2.0.6/lib/maven-core-2.0.6-uber.jar
which fails.
Workaround so far:
- do not define the antrun plugin version in parent POM
- move the plugin dependencies to the project's dependencies, e.g. using test scope, and use the maven.test.classpath instead of the maven.plugin one.
The problem is probably not related to antrun itself but to maven. I'll see if I get to create a test case. If it's in maven, then I am out of luck, as I am unable to move to a newer version of maven for a while.
Attachments
Issue Links
- duplicates
-
MANTRUN-51 Problems with multiple antrun declarations in multiproject
- Closed