title: Maven plugin - pass parameters to a lifecycle phase
body: <p>We have a custom maven plugin which generates some code artifacts for our project. The plugin has configured the lifecycle like this, with the 'generate-resources' phase calling our custom class. </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;component-set&gt;
      &lt;components&gt;
          &lt;component&gt;
              &lt;role&gt;org.apache.maven.lifecycle.mapping.LifecycleMapping&lt;/role&gt;
              &lt;role-hint&gt;zip&lt;/role-hint&gt;
              &lt;implementation&gt;org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping&lt;/implementation&gt;
              &lt;configuration&gt;
                  &lt;phases&gt;
                      &lt;generate-resources&gt;com.b.e:productconfig-maven-plugin:generate&lt;/generate-resources&gt;
                      &lt;package&gt;com.b.e:productconfig-maven-plugin:zip&lt;/package&gt;
                      &lt;install&gt;org.apache.maven.plugins:maven-install-plugin:install&lt;/install&gt;
                      &lt;deploy&gt;org.apache.maven.plugins:maven-deploy-plugin:deploy&lt;/deploy&gt;
                  &lt;/phases&gt;
              &lt;/configuration&gt;
          &lt;/component&gt;
      &lt;/components&gt;
  &lt;/component-set&gt;
  </code></pre>
  
  <p>We've a new requirement to run this 'generate-resources' phase with slightly different parameters. I had hoped we could define a second phase and passing in the mojo custom properties like this</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;component-set&gt;
      &lt;components&gt;
          &lt;component&gt;
              &lt;role&gt;org.apache.maven.lifecycle.mapping.LifecycleMapping&lt;/role&gt;
              &lt;role-hint&gt;zip&lt;/role-hint&gt;
              &lt;implementation&gt;org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping&lt;/implementation&gt;
              &lt;configuration&gt;
                  &lt;phases&gt;
                      &lt;generate-resources&gt;com.b.e:productconfig-maven-plugin:generate -Dmojo.param=A&lt;/generate-resources&gt;
                      &lt;generate-resources&gt;com.b.e:productconfig-maven-plugin:generate -Dmojo.param=B&lt;/generate-resources&gt;
                      &lt;package&gt;com.b.e:productconfig-maven-plugin:zip&lt;/package&gt;
                      &lt;install&gt;org.apache.maven.plugins:maven-install-plugin:install&lt;/install&gt;
                      &lt;deploy&gt;org.apache.maven.plugins:maven-deploy-plugin:deploy&lt;/deploy&gt;
                  &lt;/phases&gt;
              &lt;/configuration&gt;
          &lt;/component&gt;
      &lt;/components&gt;
  &lt;/component-set&gt;
  </code></pre>
  
  <p>but this throws this error.</p>
  
  <pre><code>[ERROR] Could not find goal 'generate -Dmojo.param=A' in plugin com.b.e:productconfig-maven-plugin:1.0.6-SNAPSHOT among available goals generate, zip -&gt; [Help 1]
  org.apache.maven.plugin.MojoNotFoundException: Could not find goal 'generate -DoutputFileBaseDir=/home/poc/b/product_configuration/productconfig-maven-plugin/target/generated/delta' in plugin com.b.e:productconfig-maven-plugin:1.0.6-SNAPSHOT among available goals export, generate
      at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:267)
      at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:185)
      at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:152)
      at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:139)
      at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:116)
      at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:129)
      at org.apache.maven.lifecycle.internal.BuilderCommon.resolveBuildPlan(BuilderCommon.java:92)
  </code></pre>
  
  <p>Does anybody know a way to correctly pass parameters into a lifecycle phase?</p>