Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-dev] executing maven goal from user's request

Hello m2e-devs,

I have an eclipse plugin I'm building that adds some support for custom maven goals for one of my companies maven build plugins.  Basically I want the user to be able to manually invoke a particular execution of a maven goal via a button or toolbar, etc. and then my code could execute the approach maven goal/execution automatically.  So when they select the action, someway I need to programmatically execute a command like this: 

mvn liferay:build-serivce

My question is what is the correct m2e-API for me to use.  One idea would be to use the m2e build launch configuration type (org.eclipse.m2e.Maven2LaunchConfigurationType) and invoke a full launch?

The other approach I could see would be using the IMaven api more directly, something like:
IMaven maven = MavenPlugin.getMaven();
then maven.execute(...) command?

The 2nd approach seems simpler and more testable (wouldn't require UI plugin for unit testing), but not sure feasible that approach would be.

Would love to hear other m2e-* developers thoughts.

Thanks 

--
Greg Amerson
Liferay Developer Tools
Liferay, Inc. www.liferay.com

Back to the top