Note that there are some explanatory texts on larger screens.

plurals
  1. POmaven assembly dir with a jar dependency from project
    primarykey
    data
    text
    <p>I am trying to use maven to assemble a directory for a install package. The install package requires several things: configuration files, dependency libraries and an executable jar of my class files. I am having trouble figuring out how to add the executable jar.</p> <p>Here is what I have so far:</p> <pre class="lang-xml prettyprint-override"><code>&lt;project&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;com.myproject&lt;/groupId&gt; &lt;artifactId&gt;myproject&lt;/artifactId&gt; &lt;version&gt;8.1.1&lt;/version&gt; &lt;name&gt;my project&lt;/name&gt; &lt;packaging&gt;pom&lt;/packaging&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;2.2&lt;/version&gt; &lt;configuration&gt; &lt;source&gt;1.6&lt;/source&gt; &lt;target&gt;1.6&lt;/target&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt; &lt;version&gt;2.2-beta-2&lt;/version&gt; &lt;configuration&gt; &lt;descriptor&gt;${basedir}/src/main/assembly/client.xml&lt;/descriptor&gt; &lt;/configuration&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;create-client&lt;/id&gt; &lt;configuration&gt; &lt;descriptor&gt;${basedir}/src/main/assembly/client.xml&lt;/descriptor&gt; &lt;/configuration&gt; &lt;phase&gt;package&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;single&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;dependencies&gt; . . . &lt;/dependencies&gt; &lt;/project&gt; </code></pre> <p>Then my assembly descriptor looks like this:</p> <pre class="lang-xml prettyprint-override"><code>&lt;assembly&gt; &lt;id&gt;client&lt;/id&gt; &lt;formats&gt; &lt;format&gt;dir&lt;/format&gt; &lt;/formats&gt; &lt;includeBaseDirectory&gt;false&lt;/includeBaseDirectory&gt; &lt;fileSets&gt; &lt;fileSet&gt; &lt;directory&gt;${basedir}/src/main/reports&lt;/directory&gt; &lt;outputDirectory&gt;/reports&lt;/outputDirectory&gt; &lt;/fileSet&gt; &lt;fileSet&gt; &lt;directory&gt;${basedir}/src/main/resources/audio&lt;/directory&gt; &lt;outputDirectory&gt;/audio&lt;/outputDirectory&gt; &lt;/fileSet&gt; &lt;fileSet&gt; &lt;directory&gt;${basedir}/src/main/client&lt;/directory&gt; &lt;outputDirectory&gt;/&lt;/outputDirectory&gt; &lt;/fileSet&gt; &lt;/fileSets&gt; &lt;dependencySets&gt; &lt;dependencySet&gt; &lt;scope&gt;runtime&lt;/scope&gt; &lt;useProjectArtifact&gt;false&lt;/useProjectArtifact&gt; &lt;outputDirectory&gt;lib&lt;/outputDirectory&gt; &lt;unpack&gt;false&lt;/unpack&gt; &lt;/dependencySet&gt; &lt;/dependencySets&gt; &lt;/assembly&gt; </code></pre> <p>If i call mvn assembly:assembly I get a directory with all the libraries and configuration files. Works great.</p> <p>But now I want to add an executable jar of all my compiled code. I can create this jar alone by adding this to my pom and calling mvn jar:jar</p> <pre class="lang-xml prettyprint-override"><code> &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt; &lt;version&gt;2.4&lt;/version&gt; &lt;configuration&gt; &lt;finalName&gt;run&lt;/finalName&gt; &lt;archive&gt; &lt;manifest&gt; &lt;mainClass&gt;com.myproject.main.StartProcess&lt;/mainClass&gt; &lt;addClasspath&gt;true&lt;/addClasspath&gt; &lt;classpathPrefix&gt;lib/&lt;/classpathPrefix&gt; &lt;/manifest&gt; &lt;/archive&gt; &lt;/configuration&gt; &lt;/plugin&gt; </code></pre> <p>The question is, how can I get that jar into my assembly automatically? I have tried a couple things but I have no idea where to start. Can I somehow call the jar execution from my assembly?</p> <p>Any help appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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