2 Replies Last post: Oct 24, 2011 8:22 PM by infinity2heaven  
infinity2heaven Newbie 35 posts since
Dec 17, 2008
Currently Being Moderated

Oct 24, 2011 12:27 AM

How to parameterize maven goals?

How do you pass parameters to maven goals windoow (right hand side) like -DskipTests=true. I couldn't find how to costomize a goal.

Mark Vedder Apprentice 826 posts since
Dec 10, 2003
Currently Being Moderated
Oct 24, 2011 7:15 PM in response to: infinity2heaven
Re: How to parameterize maven goals?

For a global switch (which will apply to all goals when run), open the Maven settings (you can either click the wrench icon in the maven tool window, or go to Settings (Ctrl+Alt+S) > Project Settings > Maven. Expand the "Maven" node on the left and select "runner". There you can add any VM options and/or properties to be passed into maven. There is also a "Skip Tests" option you can select. Again, this will apply to all maven goals for the project. See Reference > Settings Dialog > Project Settings > Maven in the help guide or the online web help for more information.

 

To configure for a specific goal so that the switches apply only to that goal, you need to run the gaol via a run configuration. Create a run configuration for the goal (right click the goal and select Create "{pomName} [{goal}]"). When editing the goal, select the runner tab. There you can add any VM options and/or properties to be passed into maven. There is also a "Skip Tests" option you can select. You will then need to run the goal via the run configuration. It will be listed in the run configurations drop down in the toolbar. Or you can type Ctrl+Alt+F10 to open a popup of all the run configurations. See References > Dialogs > Run/Debug Configurations > Run/Debug Configuration: Maven in the help guide or the online web help for more information.

 

Finally, if you want all new maven run configurations to have a particular default, you can edit the default values for new maven run configurations. Open the "Edit Configurations" option from the run configurations drop down, or the Ctrl+Alt+F10 popup. On the left, expand the "Defaults" node. Find the Maven node under the Defaults node. Select it and edit the values on the Runner tab.

 

I hope that helps.

 

Best Regards,

Mark

More Like This

  • Retrieving data ...