maven-embedder

Error when execute MavenCli in the loop (maven-embedder)?

匆匆过客 提交于 2021-02-10 18:25:15
问题 What is the problem when I execute the maven command in the loop ? The goal is to update the version of pom.xml of the list of bundles. The first iteration, maven execute correctly (update pom.xml), but it makes error for all item after. for (String bundlePath: bundlesToUpdate) { MavenCli cli = new MavenCli(); String[] arguments = { "-Dtycho.mode=maven", "org.eclipse.tycho:tycho-versions-plugin:set-version", "-DgenerateBackupPoms=false", "-DnewVersion=" + version}; int result = cli.doMain

Invocation of MavenCli fails within a Maven plugin

心已入冬 提交于 2021-02-07 08:47:38
问题 I've created small util to wrap MavenCli , which generates a new Maven project, using the quickstart archetype. When executing the Util as a unit test, it is working quite well (just generating an empty Maven project). Now I want to integrate this small wrapper into a Maven plugin. But when I execute the mojo (within a third Maven project), the invocation of MavenCli fails with exception: [ERROR] Error executing Maven. [ERROR] java.util.NoSuchElementException role: org.apache.maven.eventspy

Invocation of MavenCli fails within a Maven plugin

最后都变了- 提交于 2021-02-07 08:47:11
问题 I've created small util to wrap MavenCli , which generates a new Maven project, using the quickstart archetype. When executing the Util as a unit test, it is working quite well (just generating an empty Maven project). Now I want to integrate this small wrapper into a Maven plugin. But when I execute the mojo (within a third Maven project), the invocation of MavenCli fails with exception: [ERROR] Error executing Maven. [ERROR] java.util.NoSuchElementException role: org.apache.maven.eventspy

Unable to run maven tasks through MavenCli (maven-embedder)

不羁岁月 提交于 2019-12-07 03:02:35
问题 I am using Maven embedder 3.3.3 in my program to run maven goals programmatically and I get the following error every time I run the MavenCli.doMain method: -Dmaven.multiModuleProjectDirectory system property is not set. Check $M2_HOME environment variable and mvn script match. 回答1: Since Maven 3.3.1, there is a new system property called maven.multiModuleProjectDirectory . It is set by default to the root of the project (project base directory) by the mvn (or mvn.bat) script (so that is why

Unable to run maven tasks through MavenCli (maven-embedder)

送分小仙女□ 提交于 2019-12-05 08:03:13
I am using Maven embedder 3.3.3 in my program to run maven goals programmatically and I get the following error every time I run the MavenCli.doMain method: -Dmaven.multiModuleProjectDirectory system property is not set. Check $M2_HOME environment variable and mvn script match. Tunaki Since Maven 3.3.1 , there is a new system property called maven.multiModuleProjectDirectory . It is set by default to the root of the project (project base directory) by the mvn (or mvn.bat ) script (so that is why you never experienced such an error before). Therefore, when running Maven through maven-embedder ,

How to run maven from java?

耗尽温柔 提交于 2019-11-26 12:22:01
I want to execute maven command from Java for development of a plugin. I tried maven-embedder but looks like it is now not supported. Is someone aware of some other tool which can be used? user3254289 A simple invocation API : maven-invoker. Project documentation : http://maven.apache.org/shared/maven-invoker/ Usage : http://maven.apache.org/shared/maven-invoker/usage.html InvocationRequest request = new DefaultInvocationRequest(); request.setPomFile( new File( "/path/to/pom.xml" ) ); request.setGoals( Arrays.asList( "clean", "install" ) ); Invoker invoker = new DefaultInvoker(); invoker

How to run maven from java?

纵然是瞬间 提交于 2019-11-26 02:56:22
问题 I want to execute maven command from Java for development of a plugin. I tried maven-embedder but looks like it is now not supported. Is someone aware of some other tool which can be used? 回答1: A simple invocation API : maven-invoker. Project documentation : http://maven.apache.org/shared/maven-invoker/ Usage : http://maven.apache.org/shared/maven-invoker/usage.html InvocationRequest request = new DefaultInvocationRequest(); request.setPomFile( new File( "/path/to/pom.xml" ) ); request