Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoking Actions other than Build and Clean & Build

I am new to NetBeans and am trying to define and run various custom goals for my Maven proj. My Maven proj uses a number of plugins; once for building the Java classes, another for pre-compiling JSPs, another for building an OSGi bundle, and another for deploying to my dev app server.

It seems that by default, NetBeans has Build, and Clean & Build as easily accessible "build options" in the main toolbar bar. These trigger the install goal which runs through the entire build processes (compiles everything and deploys to my dev).

In NetBeans, I can edit the Properties for the project, and define a "development" profile, and then define custom actions (or modify the default NetBeans actions).

How do I:

  1. Invoke Actions that aren't Build or Clean & Build in NetBeans

  2. Define only certain goals for specific plugins to run, and invokes those actions.

like image 724
empire29 Avatar asked Feb 27 '12 01:02

empire29


2 Answers

This is really just a comment on @Ev0oD's answer, but I want to add an image so it has to be a separate answer.

After I created the toolbar button using:

Tools -> Options -> Java -> Maven -> Execution -> Edit Global Custom Goal Definitions

I then had to add the button to the toolbar using:

View -> Toolbars -> Customize (or just right click the toolbar header and select Customize)

I could then see the new button in the "Maven" group in this dialog: Adding new Maven action button to toolbar

I then had to drag the button onto a toolbar as shown. Note: Don't try to drag it to the blank part on the right of the toolbar header as this won't work.

like image 158
Glenn Lawrence Avatar answered Sep 22 '22 09:09

Glenn Lawrence


If you want to use some custom goals on more projects and you want to have a quick access to them, you can use global custom goals, that are present in NetBeans 8.0.1 (not sure in which version they were introduced).

Access Tools -> Options -> Java -> Maven -> Execution -> Edit Global Custom Goal Definitions...

There you can add many of these and they will be present for all projects in the Custom section, as shown in the accepted answer.

A good thing is you can add it also to the Toolbar by clicking (Show in toolbar) and selecting one of six different colors of icon available. You will end up with something like this:

http://i.snag.gy/Ldjg3.jpg

like image 34
Ev0oD Avatar answered Sep 22 '22 09:09

Ev0oD