Invoking Actions other than Build and Clean & Build

自闭症网瘾萝莉.ら 提交于 2019-11-28 09:59:40

First go to the Project Properties > Actions and create your MVN build

The above will run:

mvn install -P initdb,initdb-qa -DskipTest=true -Dprop.name=dev

Then it will become available under "Custom"

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:

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.

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:

alternatively you can use the Custom popup on project node and within the Custom... action's dialog, setup goals for execution and eventually remember the setup for subsequent executions. The remembered item will appear in the same popup menu. For global (for every project) goal definitions, please see the global options.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!