title: How to Change the Package of a Maven Plug-in With Testing Harness
body: <p>I used <a href="https://maven.apache.org/plugin-testing/maven-plugin-testing-harness/getting-started/index.html" rel="nofollow noreferrer">this tutorial</a> to create a very basic setup to create and test a Maven mojo. The two classes look something like this.</p>
  
  <p><strong>Mojo:</strong></p>
  
  <pre><code>/**
   * @goal touch
   * @phase process-sources
   */
  public class MyMojo extends AbstractMojo {
      public void execute() throws MojoExecutionException {
          // stuff
      }
  }
  </code></pre>
  
  <p><strong>Test:</strong></p>
  
  <pre><code>public class MyMojoTest {
      @Rule
      public MojoRule rule = new MojoRule();
  
      @Test
      public void testSomething() throws Exception {
          File pom = new File("src/test/resources/pom.xml");
          MyMojo myMojo = (MyMojo) rule.lookupMojo("touch", pom);
          Assert.assertNotNull(myMojo);
          myMojo.execute();
      }
  }
  </code></pre>
  
  <p>It works so far. Then I moved it to my own project, to see why my tests wouldn't work. It still worked until I moved the classes into another package.</p>
  
  <p>The default is <code>org.apache.maven.plugin.my</code> and I'm not sure if that is somehow forced for all Maven plug-ins or taken from some weird property I can't figure out. </p>
  
  <p>Properties that don't contribute to this package are:</p>
  
  <ul>
  <li>pom's artifact ID</li>
  <li>pom's group ID</li>
  <li>pom's version</li>
  </ul>
  
  <p>The error message is:</p>
  
  <pre><code>org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
        role: org.apache.maven.plugin.Mojo
    roleHint: org.acme:maven-my-plugin:1.0.0-SNAPSHOT:touch
      at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:264)
      at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:240)
      at org.codehaus.plexus.PlexusTestCase.lookup(PlexusTestCase.java:205)
      at org.apache.maven.plugin.testing.AbstractMojoTestCase.lookupMojo(AbstractMojoTestCase.java:389)
      at org.apache.maven.plugin.testing.AbstractMojoTestCase.lookupMojo(AbstractMojoTestCase.java:334)
      at org.apache.maven.plugin.testing.MojoRule.lookupMojo(MojoRule.java:164)
      at org.apache.maven.plugin.my.MyMojoTest.testSomething(MyMojoTest.java:22)
  </code></pre>
  
  <p>So how do I change the package? <code>org.apache.maven.plugin.my</code> sounds really tutorially.</p>