tags:

views:

160

answers:

2

My project requires features of a new version of a maven build plugin for some of its goals, but the new version fails (due to a bug in the plugin) on one of the other goals. As a workaround until the bug is fixed, I'd like to run the broken goal with an older version of the plugin. Edit: More specifically, I need to run the generateAsync goal with version 1.1 of the gwt-maven-plugin and all other goals with version 1.2-SNAPSHOT.

When I declare a separate plugin version to execute the broken goal, Maven still uses the broken version. Is there another way to solve this problem?

<plugin>
 <groupId>org.codehaus.mojo</groupId>
 <artifactId>gwt-maven-plugin</artifactId>
 <version>1.1</version>
   <executions>
     <execution>
       <goals>
         <!-- this goal is broken in 1.2-SNAPSHOT -->
         <goal>generateAsync</goal>
       </goals>
     </execution>
   </executions>
   ...
 </plugin>
 <plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>gwt-maven-plugin</artifactId>
   <version>1.2-SNAPSHOT</version>
   <executions>
     <execution>
       <goals>
         <goal>compile</goal>
         <!-- <goal>generateAsync</goal> -->
         <goal>test</goal>
       </goals>
     </execution>
   </executions>
   ...
</plugin>
A: 

I think that what your looking for is the phase element on the plugin configuration. The goal element indicates which goal of the plugin you want to execute, the phase does what you want which is to indicate in which phase should the goal of the plugin be executed.

You can see more about this here.

Hugo Palma
The goals all run in their default lifecycle phases, and I'm fine with that. The problem is that I need to run some goals with version 1.1 of the plugin and others with version 1.2-SNAPSHOT.
Aaron Novstrup
Would profiles work for you then ?You wouldn't be able to execute both goal in one go but i guess it would be much better than changing the pom by hand.
Hugo Palma
Yeah, I'm considering profiles -- just hoping there's a cleaner solution.
Aaron Novstrup
+1  A: 

You must not declare the same plugin twice in your POM. What is possible is to use one <plugin> block with two <executions> but this won't solve your issue so, no, there is no way to achieve what you want.

But did you test the gwt-maven-plugin 1.2 release candidate? It has been made available today here http://people.apache.org/~nicolas/staging/, vote is open for 72h and tests are welcome. Maybe your issue is solved in this version (not sure though as you didn't give much details on the problem and as I didn't find any issue related to gwt:generateAsync in the issue tracker of the plugin that has been recently closed or opened).

If you have a particular problem not listed in the issue tracker, it seems to be the perfect time to make people aware of it, especially if you want it solved in version 1.2. The ball is in your court.

Pascal Thivent
It fails with the RC, too. Just posted an issue.
Aaron Novstrup
Good initiative IMHO. Good luck!
Pascal Thivent