I've been looking to do something similar, I wanted to add an action to the end of my build to auto-deploy the generated jar to my test server.
I'm not sure if it's the best way, but the Exec Maven Plugin allows you to execute system commands.
I updated my project configuration such that the nbactions.xml has the following:
<action>
<actionName>CUSTOM-SendToDevSrv</actionName>
<displayName>SendToDevSrv</displayName>
<goals>
<goal>install</goal>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-pw myPasswd "D:\\pathTo\myGenerated.jar" user@myDevSrv.com:/pathTo/myCopied.jar</exec.args>
<exec.executable>D:\pathTo\my.exe</exec.executable>
</properties>
</action>
It's also possible to add the action via the project customisation menu:
- Right Click the project -> Set Configuration -> Customize...
- Under the Category "Actions" Add Custom...
- Fill in the execute goals with
process-classes org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
- Fill in the set properties with
exec.args=-s localhost invoke "jboss.system:service=MainDeployer" redeploy "file:/hileWhichYouWantReDeploy"
exec.executable=absolutePathTo/jbossAs/bin/twiddle.sh
Notes:
- You may be able to do this without absolute paths, but I have not tried.
- It's also possible to modify existing actions such that the Build action executes the Maven exec goal just after the install goal.
- I realise that I have not at all addressed your desire to do this on a button click... sorry. However, it seems possible to customise the netbeans toolbars with custom actions. I leave that research for someone else...