2
votes

I have a multi-module maven project (maven 2.2.1). One of the module is a maven plugin.

This plugin is bound to the compile phase of another module, and added as a direct dependency to trigger correct reactor ordering of module's building.

If I run 'mvn clean install' on the root module, with a fresh local repository, everything goes fine (build, test, install). (I precise that my project's artifacts are not deployed anywhere, only installed locally in my machine's local repo).

BUT if I delete my local repository, and perform 'mvn test', the plugin module is reported as missing ? Whereas, the build order is correct, the plugin module is built succesfully before the module using it ???

Is there any special treatment of maven module with 'maven-plugin' packaging ? I don't understand why other project inter modules dependencies are resolved correctly and not this specific one !

1
What i don't understand why you need to change the reactor build order? Isn't the order correct? - khmarbaise
Well, if I simply put the binding of the plugin in my client module in <build><plugins></plugins></build>, the plugin module is build after the client module. - M'λ'
That's what i expected, cause a dependency is something different. This is what you give via <dependencies> and not in the <build> area. The simplest solution is to put a <dependency> on the maven-module into a module which needed that. That should handle that the reactor order will be changed accordingly. - khmarbaise
I'm not sure if a understand the thing correct. Is the plugin needed for that build or does the plugin dependends on the other modules? The best solution for plugins is to develop them separately. For integration-testing you can use the maven-invoker. - khmarbaise
Thanks for your points ; however, using the <dependecy>, I successfully built the maven plugin module before the module that needs it. Your second answer below makes perfectly sense in my context and I will further investigate why this point in mind ! :) - M'λ'

1 Answers

0
votes

The problem is that a Maven Plugin must be installed into the local repository first before you can use a plugin as a dependency (or better be part of the life-cycle).