Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
1.1
-
None
-
None
-
Windows XP Pro
Description
I have a classloading issue with ant optional tasks which I've imported via ant-nodeps-1.6.5.jar.
I have a multi-module maven project with three levels of heirarchy.
1
a
i
ii
b
i
ii
2
...
...
I'm using the maven-antrun-plugin in module 1.a.i in the following manner.
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>execution1</id>
<phase>generate-sources</phase>
<configuration>
<tasks>
<replaceregexp flags="g"
file="${file}"
match="${match}"
replace="${replace}"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>${ant-nodeps.ver}</version>
</dependency>
<dependency>
<groupId>jakarta-regexp</groupId>
<artifactId>jakarta-regexp</artifactId>
<version>${jakarta-regexp.ver}</version>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-jakarta-regexp</artifactId>
<version>${ant-jakarta-regexp.ver}</version>
</dependency>
</dependencies>
</plugin>
If I cd to the the 1.a.i directory, and execute mvn generate-sources, all is fine. But if I execute the same command from either 1 or 1.a, I get the following error:
Embedded error: Could not create task or type of type: replaceregexp.
Ant could not find the task or a class this task relies upon.
This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
- You have misspelt 'replaceregexp'.
...blah blah blah
Now this is because it can't find the classes in the ant-nodeps, jakarta-regexp and ant-jakarta-regexp jars even though they are explicitly declared in the dependencies for the plugin.
I messed around with the <classloader>root</classloader> variable by specifying it in the pom but that didn't go anywhere. I've also tried to declare the dependencies as part of the pom rather than the plugin but with no success.
I'm following the instructions here (Using optional ant tasks).
http://maven.apache.org/plugins/maven-antrun-plugin/classpaths.html
Attachments
Issue Links
- duplicates
-
MNG-1323 Plugin extensions (dependencies) not resolved in reactor build
- Closed