My project requires using custom Maven plugin, and I am looking for simple way to build it, preferably without messing local repository.
Let's consider simple projects tree:
root-project
|---pom.xml
|---my-library
| \---pom.xml
|---my-maven-plugin
| \---pom.xml
\---my-project
\---pom.xml
root-project has three subprojects listed as <modules> inside. The main thing is that my-project uses my-maven-plugin during it's build process, so the plugin must be built first.
What I would like to do, is to simply run:
root-project $ mvn package
This should build my-maven-plugin first and use it during build of my-project.
Unfortunately, this does not work. Maven stops working during "scanning for projects..." phase, with error message:
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
It works if I do first
$ cd my-maven-plugin
$ mvn install
$ cd ..
$ mvn package
It does not look good. However, real problem is that the plugin depends itself on my-library (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.
Is there any way to say Maven that it should build the plugin first (with deps), and later use it during my-project building?