Maven assembly plugin: prerequisite but not bind -


i know can bind assembly plugin "package" phase of project want different:

  • when run mvn package execute without assembly
  • when run mvn assembly:single execute package phase first.

i know can mvn package assembly:single manually verbose , error prone: if edit code , forget put "package" mvn assembly:single, generate the old version of code in assembly, without compiling changed code.

when running cli mvn package assembly:single must (see update) provide required properties single goal explains why error prone.

but, if add following plugin definition pom under build plugins section:

<plugin>     <groupid>org.apache.maven.plugins</groupid>     <artifactid>maven-assembly-plugin</artifactid>     <version>2.4</version>     <executions>         <execution>             <id>default-cli</id>             <phase>never</phase> <!-- or undefined -->             <goals>                 <goal>single</goal>             </goals>             <configuration>            ...             </configuration>         </execution>     </executions> </plugin> 

when running mvn clean package assembly plugin won't run single goal because not binded phase.

when running mvn clean package assembly:single, after package phase done assembly:single run configuration pom because it's execution id default-cli.

update

to correct myself, if running cli, executions tag not unnecessary semantically incorrect use.

just reference, plugin definition:

<plugin>     <groupid>org.apache.maven.plugins</groupid>     <artifactid>maven-assembly-plugin</artifactid>     <version>2.4</version>     <configuration>            <descriptor>path/to/descriptor</descriptor>     </configuration>             </plugin> 

the command mvn assembly:single equivalent command mvn assembly:single -ddescriptor=path/to/descriptor. when run outputs console:

[info] --- maven-assembly-plugin:2.4:single (default-cli) @ fm-js --- 

the first definition useful if want use plugin both command line , during phase different configurations.

as question, asked, imho, not possible without reprogramming plugin. suggestion in non-portable or portable form, respectively:

  • wrap command mvn package assembly:single in shell script
  • write groovy script gmaven-mojo plugin summons command mvn package assembly:single

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -