Note that there are some explanatory texts on larger screens.

plurals
  1. POmaven embed dependency artifact code in jar
    primarykey
    data
    text
    <p>I have a multi-module maven project. I have a main "base-code" module which creates a jar of all the compiled source code in my project.</p> <p>I have another module, "executable", which creates an executable jar from the same source code. To avoid duplication I want to pull the classes in from the "base-code" module. </p> <p>I thought that all I had to do was make the "base-code" module a dependency of the "executable" module to do this. But I just get an empty jar. What am I doing wrong? (my "executable" pom is below)</p> <pre><code> &lt;project&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;parent&gt; &lt;groupId&gt;com.myproject/groupId&gt; &lt;artifactId&gt;myproject&lt;/artifactId&gt; &lt;version&gt;1&lt;/version&gt; &lt;/parent&gt; &lt;artifactId&gt;executable&lt;/artifactId&gt; &lt;packaging&gt;jar&lt;/packaging&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;com.myproject/groupId&gt; &lt;artifactId&gt;code-base&lt;/artifactId&gt; &lt;version&gt;1&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;plugins&gt; &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;runnable&lt;/finalName&gt; &lt;archive&gt; &lt;manifest&gt; &lt;mainClass&gt;com.myproject.Main&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; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre>
    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