Classloader issue with ant optional tasks in a hierarchical structure ---------------------------------------------------------------------
Key: MANTRUN-61 URL: http://jira.codehaus.org/browse/MANTRUN-61 Project: Maven 2.x Antrun Plugin Issue Type: Bug Affects Versions: 1.1 Environment: Windows XP Pro Reporter: Zarar Siddiqi 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 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira