title: How to bind plugin mojos (goals) to few phases of default lifecycle?
body: <p>My <a href="https://github.com/Codearte/accurest-maven-plugin" rel="noreferrer">custom maven plugin</a> have three goals (mojos):</p>
  
  <ul>
  <li><code>convert</code> assigned to default phase: <code>process-test-resources</code></li>
  <li><code>generateStubs</code> assigned to default phase: <code>package</code></li>
  <li><code>generateTests</code> assigned to default phase: <code>generate-test-sources</code></li>
  </ul>
  
  <p>How to bind this three mojo to <a href="https://maven.apache.org/ref/3.3.9/maven-core/lifecycles.html#default_Lifecycle" rel="noreferrer">default lifcycle phase</a>, so the user can simply use plugin without special configuration and any changes to project <code>packaging</code>? </p>
  
  <p>User should simply add:</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;io.codearte.accurest&lt;/groupId&gt;
      &lt;artifactId&gt;accurest-maven-plugin&lt;/artifactId&gt;
      &lt;extensions&gt;true&lt;/extensions&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;io.codearte.accurest&lt;/groupId&gt;
      &lt;artifactId&gt;accurest-maven-plugin&lt;/artifactId&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;goals&gt;
                  &lt;goal&gt;convert&lt;/goal&gt;
                  &lt;goal&gt;generateStubs&lt;/goal&gt;
                  &lt;goal&gt;generateTests&lt;/goal&gt;
              &lt;/goals&gt;
          &lt;/execution&gt;
      &lt;/executions&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>I can achieve this with <code>components.xml</code> like below, but this requires some ugly hacks (specifing not existing phase - <code>ugly-fix</code>) and I'm not sure, if this solution is working in all cases.</p>
  
  <pre><code>&lt;component-set&gt;
      &lt;components&gt;
          &lt;component&gt;
              &lt;role&gt;org.apache.maven.lifecycle.Lifecycle&lt;/role&gt;
              &lt;implementation&gt;org.apache.maven.lifecycle.Lifecycle&lt;/implementation&gt;
              &lt;role-hint&gt;accurest&lt;/role-hint&gt;
              &lt;configuration&gt;
                  &lt;id&gt;accurest&lt;/id&gt;
                  &lt;phases&gt;
                      &lt;phase&gt;ugly-fix&lt;/phase&gt; // plugin fail without this
                  &lt;/phases&gt;
                  &lt;default-phases&gt;
                      &lt;process-test-resources&gt;
                          io.codearte.accurest:accurest-maven-plugin:${project.version}:convert
                      &lt;/process-test-resources&gt;
                      &lt;generate-test-sources&gt;
                          io.codearte.accurest:accurest-maven-plugin:${project.version}:generateTests
                      &lt;/generate-test-sources&gt;
                      &lt;package&gt;
                          io.codearte.accurest:accurest-maven-plugin:${project.version}:generateStubs
                      &lt;/package&gt;
                  &lt;/default-phases&gt;
              &lt;/configuration&gt;
          &lt;/component&gt;
      &lt;/components&gt;
  &lt;/component-set&gt;
  </code></pre>
  
  <p>Is this correct? Is better way to do such configuration?</p>
  
  <p>More information:</p>
  
  <ul>
  <li>Working <a href="https://github.com/Codearte/accurest-maven-plugin/blob/master/src/main/resources/META-INF/plexus/components.xml" rel="noreferrer">components.xml</a>.</li>
  <li>Sample project which is using this configuration: <a href="https://github.com/mariuszs/gs-rest-service-accurest" rel="noreferrer">https://github.com/mariuszs/gs-rest-service-accurest</a></li>
  </ul>