eclipse - Running maven goals from Java without a Maven executable installed on the machine -
i trying build project checkout code scm , build using maven. there way can achieve running maven goals java without maven home being provided(no maven installation). svn, using svnkit achieve same. maven, tried using below 2 options.
http://maven.apache.org/ref/3.0-beta-3/maven-embedder/ can give example of using org.apache.maven.cli.mavencli programattically?
for both above options, need have maven installation. suggestions?
no, include jar in project , following, compile code:
mavencli cli = new mavencli(); int result = cli.domain(new string[]{"compile"}, "workspace/miscmaven", system.out, system.out); system.out.println("result: " + result); per comment, here's how add dependency project. not install maven on system, merely includes jars in project build:
<dependency> <groupid>org.apache.maven</groupid> <artifactid>maven-embedder</artifactid> <version>3.3.3</version> </dependency> <dependency> <groupid>org.eclipse.aether</groupid> <artifactid>aether-connector-basic</artifactid> <version>1.0.2.v20150114</version> </dependency> <dependency> <groupid>org.eclipse.aether</groupid> <artifactid>aether-transport-wagon</artifactid> <version>1.0.2.v20150114</version> </dependency> <dependency> <groupid>org.apache.maven.wagon</groupid> <artifactid>wagon-http</artifactid> <version>2.9</version> </dependency> <dependency> <groupid>org.apache.maven.wagon</groupid> <artifactid>wagon-provider-api</artifactid> <version>2.9</version> </dependency> <dependency> <groupid>org.apache.maven.wagon</groupid> <artifactid>wagon-http-lightweight</artifactid> <version>2.9</version> </dependency>
Comments
Post a Comment