Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think that what you described is possible. First, create a parent POM where you declare dependencies in the <code>&lt;dependencyManagement&gt;</code> element:</p> <pre><code>&lt;project&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;groupIdA&lt;groupId&gt; &lt;artifactId&gt;parent&lt;/artifactId&gt; &lt;packaging&gt;pom&lt;packaging&gt; &lt;version&gt;1-SNAPSHOT&lt;/version&gt; ... &lt;dependencyManagement&gt; &lt;!-- Standard dependencies used in several build modules. Ensures all modules use the same version for these dependencies --&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.directwebremoting&lt;/groupId&gt; &lt;artifactId&gt;dwr&lt;/artifactId&gt; &lt;version&gt;3.0.M1&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework&lt;/groupId&gt; &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt; &lt;version&gt;3.0.0.RELEASE&lt;/version&gt; &lt;/dependency&gt; ... &lt;/dependencies&gt; &lt;dependencyManagement&gt; ... &lt;/project&gt; </code></pre> <p>Then, in a child project, declare the dependencies you need without declaring their version:</p> <pre><code>&lt;project&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;parent&gt; &lt;artifactId&gt;parent&lt;/artifactId&gt; &lt;groupId&gt;groupIdA&lt;/groupId&gt; &lt;version&gt;1-SNAPSHOT&lt;/version&gt; &lt;/parent&gt; &lt;artifactId&gt;childB&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;packaging&gt;jar&lt;/packaging&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.directwebremoting&lt;/groupId&gt; &lt;artifactId&gt;dwr&lt;/artifactId&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework&lt;/groupId&gt; &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt; &lt;/dependency&gt; ... &lt;/dependencies&gt; ... &lt;/project&gt; </code></pre> <p>Finally, use the default <a href="http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#jar-with-dependencies" rel="nofollow noreferrer"><code>jar-with-dependencies</code></a> predefined assembly descriptor to create a <em>general assembly of a binary package with all the dependency libraries included unpacked inside the archive</em>.</p> <pre><code>&lt;project&gt; [...] &lt;build&gt; [...] &lt;plugins&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt; &lt;version&gt;2.2-beta-5&lt;/version&gt; &lt;configuration&gt; &lt;descriptorRefs&gt; &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt; &lt;/descriptorRefs&gt; &lt;/configuration&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;make-assembly&lt;/id&gt; &lt;!-- this is used for inheritance merges --&gt; &lt;phase&gt;package&lt;/phase&gt; &lt;!-- append to the packaging phase. --&gt; &lt;goals&gt; &lt;goal&gt;single&lt;/goal&gt; &lt;!-- goals == mojos --&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; [...] &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre> <p>To create the project assembly, trigger the <em>package</em> phase:</p> <pre><code>mvn package </code></pre> <p>And this will produce the following assembly in the target directory:</p> <pre><code>target/child-1.0-SNAPSHOT-jar-with-dependencies.jar </code></pre> <p>I'm just not sure of what you want to do with this assembly (use it as dependency in portlet projects vs pull dependencies from the parent POM? ease the liferay deployment only?). All options are possible though.</p> <p>Refer to the <a href="http://maven.apache.org/plugins/maven-assembly-plugin/" rel="nofollow noreferrer">Maven Assembly plugin</a> documentation for more details. </p>
    singulars
    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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      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