In maven2, how do I assemble bits and pieces of different modules to create final distributions?
- by Carcassi
I have four maven project:
client api jar
web service war
ui jar
web interface war
The service war will need to be packaged to include the client api jar, together with javadocs (so that each version is distributed with a matching client and documentation). The web interface war will need the ui jar and all the dependencies (webstart/applet deployment).
So I need a 5th project that does all the packaging. How to do this with ant or a script is perfectly clear to me, but not in maven.
I tried the following:
having the javadocs included as part of the war packaging: this requires the execution of the javadocs goal in project 1 before execution of package in project 2. Haven't found a way to bind plugins/goals across different projects. Using the assembly plugin in project2 had the same problem.
create a fifth project and use the assembly plugin. Still the same problems as before, with the problem that since I need different pieces from each sub-project I do not understand how this can be done using the assembly.
Is this too hard to do in maven, and should I just give up? Or I am looking at it wrong, in which case, how should I be looking at it?
Thanks!
Upon further reflection, here is a partial answer:
Each project should build all its artifacts. This is done by having the plugins configured to run as per the prepare-resources and package phases. So, in my case, I prepare all that needs to be generated (jar, javadocs, xsd documentation, ...) as different artifacts so that a single "package" goal execution creates all. So, it's not "how project 2 forces project 1 to run different goals", but it's "make project 1 create all of its artifact as part as the normal lifecycle). This seems to simplify things.