maven - Execute script as part of mvn package -


my pom.xml contains

    <plugin>                                                                     <artifactid>maven-war-plugin</artifactid>         <version>2.3</version>                                                       <configuration>                                                                  <warname>${project.artifactid}</warname>                 <outputdirectory>${wlp.install.dir}/usr/servers/liberty/apps</outputdirectory>                 <failonmissingwebxml>false</failonmissingwebxml>             </configuration>                 </plugin> 

when run mvn package can see step running:

[info] --- maven-war-plugin:2.3:war (default-war) @ frontend ---

that's great. however, want run shell script before war file created. tried adding

<plugin>                                                                 <artifactid>maven-antrun-plugin</artifactid>                         <version>1.7</version>                                               <configuration>                                                          <tasks>                                                                  <exec dir="${basedir}"                 executable="${basedir}/src/main/webapp/concat"/>         </tasks>                                                         </configuration>                                                 </plugin> 

before maven-war plugin, not run. don't see antrun in output of mvn. adding <tasks> element <configuration> maven-war-plugin nothing either.

what can have maven run script part of mvn package?

the position in pom.xml irrelevant, have bind maven-antrun-plugin execution correct lifecycle phase (e.g. compile) shown below:

  <plugin>     <artifactid>maven-antrun-plugin</artifactid>     <version>1.7</version>     <executions>       <execution>         <phase> <!-- lifecycle phase --> </phase>         <configuration>           <target>              <!--               place ant task here. can add               can add between <target> , </target> in               build.xml.             -->            </target>         </configuration>         <goals>           <goal>run</goal>         </goals>       </execution>     </executions>   </plugin> 

see the maven-antrun-plugin usage page more details , the maven introduction build lifecycle further reference.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -