Ondra Žižka Ondra Žižka - 1 year ago 255
Java Question

How to zip and deploy a dist artefact after appassembler-maven-plugin:assemble

I have a multi-module Maven project.

In the lastly executed module, I assemble the dist directory using the Appassambler plugin.

Then I'd like to zip it and deploy as a maven artifact.

I'm about to simply zip it somehow and then use


Are there any more maven-like alternatives?

I've seen the combination of Shade plugin and
, but it seems that shade is quite hard to persuade to zip particular directory.

I'm open to any solution of the whole "assemble, zip and deploy" process.

Answer Source

Although I am quite in favor of Maven, I have to say that all Maven tools for creating an app distribution I've found, aren't satisfying. Either they are buggy, or poorly documented, or user hostile.

I have resorted to the concept I read, where the directory prepared by appassemble plugin is zipped using Ant (assembly-plugin fails at this too) and then added as one of module's artefacts.

Here's my solution, however I'll keep the question opened if someone wants to prove me wrong and provide a solution using standard Maven plugins, thanks.

                <execution> <id>createDistJar</id> 
                    <goals> <goal>run</goal> </goals>  <phase>package</phase>
                            <echo message="${project.build.directory}"/>
                            <mkdir dir="${project.build.directory}"/>
                            <zip destfile="${project.build.directory}/JawaBot-${project.version}-dist.zip"
                                basedir="target/" includes="JawaBot-${project.version}-dist-rh/**">
                    <id>uploadDistJar</id> <goals>  <goal>attach-artifact</goal>  </goals>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download