|
I'm fairly certain this is the issue I ran into. Any hope of getting an update on this issue, or a pointer where to start looking for a fix? Its obvious from Well, I have the same problem and I finally have an explanation. The problem occurs in a multi-module projects where the antrun plugin is being used in more than one module. In my case, let's say that my multi-module project has modules A and B. Both modules are using the antrun plugin, but only module B specifies an additional classpath for the antrun plugin. If I invoke the antrun plugin within module B everything works great but if I do that from the parent, then my build fails. This is because module A ran it's build cycle before B and for some reason the maven.plugin.classpath was not altered for the antrun plugin when running module B build (perhaps because it was already defined from module A). Thanks Near one year later this bug isn't not fixed yet ... A solution (not elegant) is to add your dependencies (in the dependencies of the antrun plugin section) in the pom.xml of the first module launched in the build order. Give an unique <id> for each "execution" section of the antrun plugin in your pom's and let us know if this fixes the issue. There are multiple poms, one per module. And in each pom there is a antrun section. In each antrun section there could be multiple execution section, for me there is only one exection section in each antrun declaration. And I have set a unique Id for each execution but it doesn't now work. Only plugin classpath of the first antrun section of the first pom is used in all module of a multi project. I'm looking at my build and think I have found a lead. I don't know the solution yet. Can others look at their build and see if this sounds right? The build I am having problems with this on has a parent POM. Both the child and parent POMs have separate antrun executions. Initially, when I would execute the child build, everything would work fine, including the parent executions. But in reactor, the child fails. Then I took the dependency that seems to be getting lost in the child build and duplicated it to the (seemingly) unrelated antrun plugin configuration in the parent. Problem solved. I think this configuration creates a circular dependency in my case, but it did solve the problem. Now, on to seeing what I can do with it. Maybe move the dependencies into the executions instead of at the global level. UPDATE: For some reason, comments were not showing up when I posted this. Seems this is old news. Just ran into this issue. For those encountering the same problem, Filippos's suggestion does NOT work. All of my executions have unique id elements and this behavior still occurs. I encountered this issue when using the replaceregexp task. To make it work I had to put the following inside the <plugin> def for maven-antrun-plugin: When I tried running this project as a module in a multi-module product the use of replaceregexp failed because it could not be found on the classpath. The workaround I did was (as indicated in a different comment) to add the <dependency> setting to the maven-antrun-plugin config of a module that was built before the failing module (even though that maven-antrun-plugin config didn't have any tasks needing it). Then I could build from the top pom without failure. Steinar - THANK YOU for the workaround! OMG I was going nuts for 2 days trying to figure this out. I figured it was a bug. I was simply trying to use Ant to scp some files and discovered the same - that on the module itself, it works but when exec from a parent POM on a multi-module project, the 'scp' fails. I added: <dependencies> to the ant plugin for the first executing module in the multi-module project and when the last module was exec'd w/ the 'scp' command, all worked ok. OK, so this bug is 2 years old and still causing pain. Whats the status on getting this fixed? Any interest? Thanks. still got the same problem. Using "classpathref" of taskdef to specify the classpath in which your ant task is. <plugin> <openjpac addDefaultConstructor="true" enforcePropertyRestrictions="true" tmpClassLoader="false"> I was able to work around this issue by moving the antrun plugin dependencies out to the project level, and scoping them as "provided". It's kind of a messy fix, but it at least keeps the dependencies in the correct pom.xml Thanks Anders and Aaron! That really helped me out. As I run it: <project> <!-- Dependencies. --> <build> Moving the dependency snippet to the build tag of the module did not help for me (mvn 2.0.9) but moving it to this snippet of the parent pom: <build> <pluginManagement> <plugins> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.1</version> <dependencies> <dependency> <groupId>ant</groupId> <artifactId>ant-optional</artifactId> <version>1.5.3-1</version> </dependency> </dependencies> </plugin> </plugins> </pluginManagement> I just run into this issue and used Anders Li's workaround as it's the best solution IMO. Shouldn't this have been fixed already after 3 years? |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I have the same problem. Any progress since 06/May?