Maven, run a java method or script before war is about to be built -


i thinking of using template engine generate web.xml , other things.

is there way to run java file or script before maven install command? or before war generated.

i not sure phase should be, before else looks @ web.xml can touch make new valid one.

you can use exec-maven-plugin run either program/script (using exec goal) or java program (using java goal).

the phase before package prepare-package (see default lifecycle in lifecycle reference), use that. might prefer generate web.xml earlier in lifecycle (even generate-resources).

putting these together, might try this:

  <plugin>     <groupid>org.codehaus.mojo</groupid>     <artifactid>exec-maven-plugin</artifactid>     <version>1.3.2</version>     <executions>       <execution>         <phase>prepare-package</phase>         <goals>           <goal>exec</goal>         </goals>       </execution>     </executions>     <configuration>       <executable>your_packaging_script</executable>       <!-- optional -->       <workingdirectory>/tmp</workingdirectory>       <arguments>         <argument>--some-option</argument>       </arguments>     </configuration>   </plugin> 

alternatively, might consider writing own plugin, if think idea useful more 1 project.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -