Hey everyone,
I'm using the Maven Invoker Plugin to programmatically call maven and build
projects.
I'm able to do that with Maven 2.x projects. I simply specify where the
pom.xml file is, and ask to execute it.
I was wondering if I can also build maven 1.x projects with the
maven-invoker. (I wanted to compile as I do in comand line: maven
java:compile )
This is the code I use to build Maven 2.x projects:
Properties mavenProperty = new Properties();
InvocationRequest request = new DefaultInvocationRequest();
request.setPomFile( new File( buildPath ) );
if (request.getPomFile().exists()) {
request.setGoals(Collections.singletonList("install"));
Invoker invoker = new DefaultInvoker();
File mavenHome = new File(ProjectAttributes.mavenHomePath);
invoker.setMavenHome(mavenHome);
InvocationResult result = null;
request.setProperties(mavenProperty);
result = invoker.execute(request);
}
--
David Nemer
Sent from Frankfurt Am Main, HE, Germany