Created
October 25, 2012 11:41
-
-
Save a-thomas/3952140 to your computer and use it in GitHub Desktop.
Maven Invoker API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
InvocationRequest request = new DefaultInvocationRequest(); | |
File pom = new File("MY_PROJECT/pom.xml"); | |
request.setPomFile(pom); | |
File baseDir = new File("MY_PROJECT"); | |
request.setBaseDirectory(baseDir); | |
ArrayList<String> goals = new ArrayList<String>(); | |
goals.add("clean"); | |
goals.add("install"); | |
request.setGoals(goals); | |
request.setShowErrors(true); | |
DefaultInvoker invoker = new DefaultInvoker(); | |
String mavenHome = System.getenv("MAVEN_HOME"); | |
invoker.setMavenHome(new File(mavenHome)); | |
InvocationResult result; | |
try { | |
result = invoker.execute(request); | |
} catch (MavenInvocationException e) { | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment