2

is there an easy plugin in NetBeans that would allow me to run a command from a button i could add to the toolbar? Some time ago i saw such a plugin but i can find it today. I think it had functionality to add comands that would be available in the main toolbar.

I just want to run manually from netbeans this command on a button click:

./jbossAs/bin/twiddle.sh -s localhost invoke "jboss.system:service=MainDeployer" redeploy "file:/hileWhichYouWantReDeploy"

Robert Niestroj
  • 15,299
  • 14
  • 76
  • 119
  • There's also this... http://stackoverflow.com/questions/6331320/how-to-create-a-custom-button-in-netbeans-toolbar – blackstrype Nov 07 '13 at 10:07

1 Answers1

0

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...
blackstrype
  • 451
  • 9
  • 14