I have a Maven project and after I install the project I need to run a script. I want to automize this process. My guess is that by adding something in the pom file I could automize this, but so far i haven't found how to run a script after installation. I only found how to run a script before the maven project has finised installing.
So, how can I run a script after a Maven project as finished installing?
This time the Console should show the “BUILD SUCCESS” message. To run the maven project, select it and go to “Run As > Java Application”. In the next window, select the main class to execute. In this case, select the App class and click on the Ok button.
Use the http://www.mojohaus.org/exec-maven-plugin/ exec-maven-plugin, in conjunction with an "executions" configuration block that specifies the installation phase. Make sure it is after your maven-install-plugin as plugins are ran in order (within the same phase)
(in build/plugins)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>do-something.sh</executable>
<workingDirectory>/some/dir</workingDirectory>
<arguments>
<argument>--debug</argument>
<argument>with_great_effect</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With