Specify dependency version for Maven Archetype plugin -
i working maven 3.3.3, mvn.bat
file has been removed. recommended , way run maven through mvn.cmd
file.
i using custom archetype calls maven-invoker plugin operation. note invoker plugin dependency of maven archetype plugin.
on archetype:generate
, invoker called , throws error :
error configuring command-line. reason: maven executable not found at: <maven_path>\bin\mvn.bat
this issue seems have been fixed release 2.2 of invoker, last version of maven-archetype-plugin
still uses old version of it.
how can specify, in archetype's pom, version of invoker plugin use ?
for now, i've tried configure plugin adding code archetype's pom file, had no effect, , didn't fixed error.
<plugin> <groupid>org.apache.maven.archetype</groupid> <artifactid>maven-archetype</artifactid> <version>2.4</version> <dependencies> <dependency> <groupid>org.apache.maven.shared</groupid> <artifactid>maven-invoker</artifactid> <version>2.2</version> </dependency> </dependencies> </plugin>
edit 1 : here's filtered stack trace.
[info] invoking post-archetype-generation goals: com.company.my-custom-maven-plugin:uuid-generator [info] ------------------------------------------------------------------------ [info] build failure [info] ------------------------------------------------------------------------ [info] total time: 2.777 s [info] finished at: 2016-02-08t15:09:19+01:00 [info] final memory: 18m/210m [info] ------------------------------------------------------------------------ [error] failed execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate (default-cli) on project standalone-pom: cannot run additions goals. error configuring command-line. reason: maven executable not found at: <maven_path>\bin\mvn.bat -> [help 1] org.apache.maven.lifecycle.lifecycleexecutionexception: failed execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate (default-cli) on project standalone-pom: cannot run additions goals. @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:216) @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:153) @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:145) @ org.apache.maven.lifecycle.internal.lifecyclemodulebuilder.buildproject(lifecyclemodulebuilder.java:116) @ org.apache.maven.lifecycle.internal.lifecyclemodulebuilder.buildproject(lifecyclemodulebuilder.java:80) @ org.apache.maven.lifecycle.internal.builder.singlethreaded.singlethreadedbuilder.build(singlethreadedbuilder.java:51) @ org.apache.maven.lifecycle.internal.lifecyclestarter.execute(lifecyclestarter.java:128) @ org.apache.maven.defaultmaven.doexecute(defaultmaven.java:307) @ org.apache.maven.defaultmaven.doexecute(defaultmaven.java:193) @ org.apache.maven.defaultmaven.execute(defaultmaven.java:106) @ org.apache.maven.cli.mavencli.execute(mavencli.java:862) @ org.apache.maven.cli.mavencli.domain(mavencli.java:286) @ org.apache.maven.cli.mavencli.main(mavencli.java:197) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.codehaus.plexus.classworlds.launcher.launcher.launchenhanced(launcher.java:289) @ org.codehaus.plexus.classworlds.launcher.launcher.launch(launcher.java:229) @ org.codehaus.plexus.classworlds.launcher.launcher.mainwithexitcode(launcher.java:415) @ org.codehaus.plexus.classworlds.launcher.launcher.main(launcher.java:356) caused by: org.apache.maven.plugin.mojoexecutionexception: cannot run additions goals. @ org.apache.maven.archetype.mojos.createprojectfromarchetypemojo.invokepostarchetypegenerationgoals(createprojectfromarchetypemojo.java:241) @ org.apache.maven.archetype.mojos.createprojectfromarchetypemojo.execute(createprojectfromarchetypemojo.java:219) @ org.apache.maven.plugin.defaultbuildpluginmanager.executemojo(defaultbuildpluginmanager.java:134) @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:208) ... 20 more caused by: org.apache.maven.shared.invoker.maveninvocationexception: error configuring command-line. reason: maven executable not found at: <maven_path>\bin\mvn.bat @ org.apache.maven.shared.invoker.defaultinvoker.execute(defaultinvoker.java:105) @ org.apache.maven.archetype.mojos.createprojectfromarchetypemojo.invokepostarchetypegenerationgoals(createprojectfromarchetypemojo.java:237) ... 23 more caused by: org.apache.maven.shared.invoker.commandlineconfigurationexception: maven executable not found at: <maven_path>\bin\mvn.bat @ org.apache.maven.shared.invoker.mavencommandlinebuilder.findmavenexecutable(mavencommandlinebuilder.java:597) @ org.apache.maven.shared.invoker.mavencommandlinebuilder.build(mavencommandlinebuilder.java:68) @ org.apache.maven.shared.invoker.defaultinvoker.execute(defaultinvoker.java:101) ... 24 more [error] [error] [error] more information errors , possible solutions, please read following articles: [error] [help 1] http://cwiki.apache.org/confluence/display/maven/mojoexecutionexception
this bug of maven archetype plugin: jira issue archetype-488. affects versions of plugin ≤ 2.4 , resolved version 3.0.0.
quoting jörg hohwiller in linked issue (dated 08-jan-2016 13:47):
is there workaround it?
yep. create copy of "mvn.cmd" call "mvn.bat" in maven_home/bin.
so possible work-around 2.4 or earlier make copy of mvn
executable other name.
Comments
Post a Comment