title: org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
body: <p>I try to test my maven plugin and receive weird exception. Found similar question <a href="https://stackoverflow.com/questions/15779351/component-lookup-exception-with-org-apache-maven-repository-repositorysystem-in">here</a>, but the answer didn't help.</p>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.maven&lt;/groupId&gt;
          &lt;artifactId&gt;maven-plugin-api&lt;/artifactId&gt;
          &lt;version&gt;3.3.9&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.maven&lt;/groupId&gt;
          &lt;artifactId&gt;maven-project&lt;/artifactId&gt;
          &lt;version&gt;3.0-alpha-2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.jcabi&lt;/groupId&gt;
          &lt;artifactId&gt;jcabi-aether&lt;/artifactId&gt;
          &lt;version&gt;0.10.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.maven.plugin-tools&lt;/groupId&gt;
          &lt;artifactId&gt;maven-plugin-annotations&lt;/artifactId&gt;
          &lt;version&gt;3.4&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.maven.plugin-testing&lt;/groupId&gt;
          &lt;artifactId&gt;maven-plugin-testing-harness&lt;/artifactId&gt;
          &lt;version&gt;3.3.0&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.maven&lt;/groupId&gt;
          &lt;artifactId&gt;maven-aether-provider&lt;/artifactId&gt;
          &lt;version&gt;3.3.9&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.maven&lt;/groupId&gt;
          &lt;artifactId&gt;maven-core&lt;/artifactId&gt;
          &lt;version&gt;3.3.9&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.maven&lt;/groupId&gt;
          &lt;artifactId&gt;maven-compat&lt;/artifactId&gt;
          &lt;version&gt;3.3.9&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.maven&lt;/groupId&gt;
          &lt;artifactId&gt;maven-model&lt;/artifactId&gt;
          &lt;version&gt;3.3.9&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;4.12&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>Test class:</p>
  
  <pre><code>public class ConverterMojoTest {
  
      @Rule
      public MojoRule rule = new MojoRule() {
  
          @Override
          protected void before() throws Throwable {
              super.before();
          }
  
          @Override
          protected void after() {
              super.after();
          }
      };
  
      @Rule
      public TestResources resources = new TestResources();
  
  
      @Test
      public void testExecute() throws Exception {
          File project = resources.getBasedir("valid");
          File pom = new File(project, "pom.xml");
          Assert.assertNotNull(pom);
          Assert.assertTrue(pom.exists());
  
          ConverterMojo mojo = (ConverterMojo) rule.lookupMojo("convert", pom);
          Assert.assertNotNull(mojo);
          mojo.execute();
      }
  }
  </code></pre>
  
  <p>Test project pom.xml:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.my.utils.test&lt;/groupId&gt;
      &lt;artifactId&gt;project-to-test&lt;/artifactId&gt;
      &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
      &lt;name&gt;Test&lt;/name&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;com.my.utils&lt;/groupId&gt;
                  &lt;artifactId&gt;converter-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
  
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Exception:</p>
  
  <pre><code>org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
        role: org.apache.maven.plugin.Mojo
    roleHint: com.my.utils:converter-maven-plugin:1.0.0-SNAPSHOT:convert
  </code></pre>