I\'m using Maven in the context of another build-tool (leiningen for Clojure, but this should not matter), and I would like to know how I would call a plugin like dependency:bui
Use the Maven Invoker API. Its quick and easy.
InvocationRequest request = new DefaultInvocationRequest();
request.setPomFile( new File( "/path/to/pom.xml" ) );
request.setGoals( Collections.singletonList( "install" ) );
Invoker invoker = new DefaultInvoker();
invoker.setMavenHome(new File("/usr"));
try
{
invoker.execute( request );
}
catch (MavenInvocationException e)
{
e.printStackTrace();
}
pom.xml:
org.apache.maven.shared
maven-invoker
2.1.1