jira-importer commented on issue #242:
URL: 
https://github.com/apache/maven-war-plugin/issues/242#issuecomment-2967855218

   **[Simone 
Gianni](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=simonegianni)**
 commented
   
   I parametrized the WarMojo with two booleans, one to create the folder 
structure, the other one to create the war file.
   
   Then I created a new mojo, WarOnlyMojo, goal war-package, that subclasses 
WarMojo setting only the boolean needed to produce the war file.
   
   This way, it's possible to act this way in a project pom.xml :
   
       <!-- Default execution of war plugin, without war file generation -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-war-plugin</artifactId>
         <version>2.0.2-SNAPSHOT</version>
         <configuration>
           <doCreateWarFile>false</doCreateWarFile>
         </configuration>
       </plugin>
       <!-- Execute any other plugin, binding it to the package phase -->
       <plugin>
         <groupId>xpatch</groupId>
         <artifactId>xpatch-maven-plugin</artifactId>
         <version>1.0-SNAPSHOT</version>
         <executions>
           <execution>
             <phase>package</phase>
             <goals>
               <goal>xpatch</goal>
             </goals>
           </execution>
         </executions>
       </plugin>
       <!-- Execute the war-package goal and create the war file -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-war-plugin</artifactId>
         <version>2.0.2-SNAPSHOT</version>
         <executions>
           <execution>
             <phase>package</phase>
             <goals>
               <goal>war-package</goal>
             </goals>
           </execution>
         </executions>
       </plugin>
   
   Unfortunately I found no way to "merge" the two war plugin declarations in a 
single one, since :
   - Declaring two executions makes the plugin execute 3 time, once with the 
default way, and the other two with the customized configuration.
   - Declaring the configuration together with the executions, makes the plugin 
ignore the default configuration and execute once as normal, and then with the 
war-package goal.
   
   Anyway with this it's already possible to change the cocoon-deployer-plugin 
so that it does not extend the war mojo, does not suffer from the NPE caused 
more or less from what's described here 
http://www.mail-archive.com/dev@maven.apache.org/msg60770.html, and makes it 
possible to stack multiple plugins to work on a war before it's compressed to a 
single file.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to