title: maven plugin as module
body: <p>My project requires using custom Maven plugin, and I am looking for simple way to build it, preferably without messing local repository.</p>
  
  <p>Let's consider simple projects tree:</p>
  
  <pre><code>root-project
      |---pom.xml
      |---my-library
      |       \---pom.xml
      |---my-maven-plugin
      |       \---pom.xml
      \---my-project
              \---pom.xml
  </code></pre>
  
  <p><code>root-project</code> has three subprojects listed as <code>&lt;modules&gt;</code> inside. The main thing is that <code>my-project</code> uses <code>my-maven-plugin</code> during it's build process, so the plugin must be built first.</p>
  
  <p>What I would like to do, is to simply run:</p>
  
  <p><code>root-project $  mvn package</code></p>
  
  <p>This should build <code>my-maven-plugin</code> first and use it during build of <code>my-project</code>.</p>
  
  <p>Unfortunately, this does not work. Maven stops working during "scanning for projects..." phase, with error message:</p>
  
  <p><code>Unresolveable build extension: Plugin test:my-maven-plugin:1.0 or one of its dependencies could not be resolved: Could not find artifact test:my-maven-plugin:jar:1.0</code></p>
  
  <p>It works if I do first</p>
  
  <pre><code>$ cd my-maven-plugin
  $ mvn install
  $ cd ..
  $ mvn package
  </code></pre>
  
  <p>It does not look good. However, real problem is that the plugin depends itself on <code>my-library</code> (which is another child module of root). So, before building plugin I must enter library directory and install it. Things become worse and worse with every "internal" dependency I add to plugin. The result is mess in local repository and a lot manual steps needed to rebuild project.</p>
  
  <p>Is there any way to say Maven that it should build the plugin first (with deps), and later use it during my-project building?</p>