Hi,

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 modules at three levels:

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,
everything is fine as ant finds the classes needed to run
replaceregexp.  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

Any ideas what might be wrong?

Thanks,
Zarar

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to