Specify dependency version for Maven Archetype plugin
<p>I am currently working with Maven 3.3.3, from which the <code>mvn.bat</code> file has been removed. The recommended and only way to run Maven is now through the <code>mvn.cmd</code> file.</p>

<p>I am using a custom archetype that calls the maven-invoker plugin for some operation. <a href="http://maven.apache.org/archetype/maven-archetype-plugin/dependency-management.html" rel="nofollow">Note that the invoker plugin is a dependency of the Maven archetype plugin</a>. </p>

<p>On <code>archetype:generate</code>, the invoker is called and throws an error : </p>

<blockquote>
  <p><code>Error configuring command-line. Reason: Maven executable not found at: &lt;MAVEN_PATH&gt;\bin\mvn.bat</code></p>
</blockquote>

<p>This issue seems to have been fixed with the release 2.2 of the invoker, but the last version of <code>maven-archetype-plugin</code> still uses an old version of it.</p>

<p><strong>How can I specify, in my archetype's POM, the version of the invoker plugin to use ?</strong></p>

<p>For now, I've tried to configure the plugin by adding this code into the archetype's POM file, but it had no effect, and didn't fixed the error.</p>

<pre><code>&lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.archetype&lt;/groupId&gt;
    &lt;artifactId&gt;maven-archetype&lt;/artifactId&gt;
    &lt;version&gt;2.4&lt;/version&gt;
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.apache.maven.shared&lt;/groupId&gt;
            &lt;artifactId&gt;maven-invoker&lt;/artifactId&gt;
            &lt;version&gt;2.2&lt;/version&gt;
        &lt;/dependency&gt;
    &lt;/dependencies&gt;
&lt;/plugin&gt;
</code></pre>

<p><strong>EDIT 1 :</strong>
Here's the filtered stack trace.</p>

<pre><code>[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 to 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: &lt;MAVEN_PATH&gt;\bin\mvn.bat -&gt; [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate (default-cli) on project standalone-pom: Cannot run additions goals.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot run additions goals.
    at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.invokePostArchetypeGenerationGoals(CreateProjectFromArchetypeMojo.java:241)
    at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execute(CreateProjectFromArchetypeMojo.java:219)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at 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: &lt;MAVEN_PATH&gt;\bin\mvn.bat
    at org.apache.maven.shared.invoker.DefaultInvoker.execute(DefaultInvoker.java:105)
    at 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: &lt;MAVEN_PATH&gt;\bin\mvn.bat
    at org.apache.maven.shared.invoker.MavenCommandLineBuilder.findMavenExecutable(MavenCommandLineBuilder.java:597)
    at org.apache.maven.shared.invoker.MavenCommandLineBuilder.build(MavenCommandLineBuilder.java:68)
    at org.apache.maven.shared.invoker.DefaultInvoker.execute(DefaultInvoker.java:101)
    ... 24 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
</code></pre>