Note that there are some explanatory texts on larger screens.

plurals
  1. POMaven assembly on multi module project with special structure
    text
    copied!<p>I'm new to Maven, and I think I've started to get the idea of how it works. But I'm not able to understand the maven assembly plugin. What I want to achieve is this:</p> <p>When all projects has been packaged, with their respective dependencies, I want to have them all in the target directory. I don't want them to be packaged into one super-jar because the system is based on modules.</p> <p>Let me explain, I have a main project, the server, in the maven project "common", and I have two modules, "core" and "android". In the common folder, there is also a conf folder that I want copied over. I want this structure:</p> <ul> <li>target/common.jar</li> <li>target/conf/<em>(configuration files)</em></li> <li>target/modules/core.jar</li> <li>target/modules/android.jar</li> </ul> <p>My project structure is this:</p> <ul> <li>pom.xml (parent project) </li> <li>common/ (maven module)</li> <li>core/ (maven module)</li> <li>android/ (maven module)</li> </ul> <p>Thank you for any help, or pointers in the right way. :)</p> <p><strong>EDIT</strong> Here is the ant build file which works 100%, maybe I should keep with that? </p> <p> </p> <pre><code>&lt;target name="init"&gt; &lt;mkdir dir="dist" /&gt; &lt;mkdir dir="dist/conf/" /&gt; &lt;mkdir dir="dist/modules/" /&gt; &lt;mkdir dir="dist/libs/" /&gt; &lt;copy includeemptydirs="false" todir="dist/conf"&gt; &lt;fileset dir="common/conf" /&gt; &lt;/copy&gt; &lt;/target&gt; &lt;target name="copy-server"&gt; &lt;copy todir="dist"&gt; &lt;fileset file="common/target/server*.jar" /&gt; &lt;/copy&gt; &lt;/target&gt; &lt;target name="copy-modules"&gt; &lt;copy todir="dist/modules/"&gt; &lt;fileset file="core/target/*.jar" /&gt; &lt;fileset file="android/target/*.jar" /&gt; &lt;/copy&gt; &lt;/target&gt; &lt;target name="copy-libs"&gt; &lt;copy todir="dist/libs"&gt; &lt;fileset dir="common/target/libs" /&gt; &lt;fileset dir="core/target/libs" /&gt; &lt;fileset dir="android/target/libs" /&gt; &lt;/copy&gt; &lt;delete&gt; &lt;fileset file="dist/libs/server*.jar" /&gt; &lt;/delete&gt; &lt;/target&gt; &lt;target name="clean"&gt; &lt;delete dir="dist" /&gt; &lt;/target&gt; &lt;target name="full-build" depends="clean, init, copy-server, copy-libs, copy-modules, increment"&gt; &lt;echo message="Copying the fully built Maven project" /&gt; &lt;/target&gt; &lt;target name="increment"&gt; &lt;propertyfile file="common/conf/version.properties"&gt; &lt;entry key="build.number" type="int" operation="+" default="0" /&gt; &lt;/propertyfile&gt; &lt;property file="common/conf/version.properties" /&gt; &lt;echo message="Build number is ${build.number}"/&gt; &lt;/target&gt; </code></pre> <p></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload