Note that there are some explanatory texts on larger screens.

plurals
  1. POMaven war plugin, not getting dependencies from parent pom
    primarykey
    data
    text
    <p>My objective is to include a war to another war. See My Project structure:</p> <p>+test-parent (here goes all common dependencies for spring &amp; hibernate framework) -- test-core (the collection of all common classes type:jar) -- test-web (the webapp which should run as individual webapp, depends on test-core, type:war) -- test-web-2 (the webapp which depends on test-web,test-core, type:war)</p> <p>I have used maven war plugin to achieve this.</p> <p><strong>test-parent/pom.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-parent&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;packaging&gt;pom&lt;/packaging&gt; &lt;modules&gt; &lt;module&gt;test-core&lt;/module&gt; &lt;module&gt;test-web&lt;/module&gt; &lt;module&gt;test-web-2&lt;/module&gt; &lt;/modules&gt; &lt;dependencies&gt; &lt;!-- All common spring &amp; hibernate dependencies --&gt; &lt;/dependencies&gt; &lt;/project&gt; </code></pre> <p><strong>test-core/pom.xml</strong></p> <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;parent&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-parent&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;/parent&gt; &lt;artifactId&gt;test-core&lt;/artifactId&gt; &lt;/project&gt; </code></pre> <p><strong>test-web/pom.xml</strong></p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;parent&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-parent&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;/parent&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-web&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;packaging&gt;war&lt;/packaging&gt; &lt;name&gt;test-web Maven Webapp&lt;/name&gt; &lt;url&gt;http://maven.apache.org&lt;/url&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;junit&lt;/groupId&gt; &lt;artifactId&gt;junit&lt;/artifactId&gt; &lt;version&gt;3.8.1&lt;/version&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-core&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;finalName&gt;test-web&lt;/finalName&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt; &lt;version&gt;2.4&lt;/version&gt; &lt;configuration&gt; &lt;packagingIncludes&gt;**/*.xml,**/*.properties,**/*.class,**/*.png,**/*.css,**/*.js,**/*.jsp&lt;/packagingIncludes&gt; &lt;packagingExcludes&gt;WEB-INF/web.xml&lt;/packagingExcludes&gt; &lt;attachClasses&gt;true&lt;/attachClasses&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre> <p><strong>test-web-2/pom.xml</strong></p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;parent&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-parent&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;/parent&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-web-2&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;packaging&gt;war&lt;/packaging&gt; &lt;name&gt;test-web-2 Maven Webapp&lt;/name&gt; &lt;url&gt;http://maven.apache.org&lt;/url&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;junit&lt;/groupId&gt; &lt;artifactId&gt;junit&lt;/artifactId&gt; &lt;version&gt;3.8.1&lt;/version&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-web&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;type&gt;war&lt;/type&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-web&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;classifier&gt;classes&lt;/classifier&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;finalName&gt;test-web-2&lt;/finalName&gt; &lt;/build&gt; &lt;/project&gt; </code></pre> <p>As my test-web-2 depends on test-web, I want to merge all classes,resources in test-web-2. when I run <code>mvn install</code> my all builds are successful, but when I run test-web or test-web-2 on server, it has no lib folder under WEB-INF with all required spring jars from parent.</p> <p>I have given package &amp; jsp file names different in both projects. I am even able to see the proper merged build as required.</p> <p>How can I get this lib folder generated in both test-web &amp; test-web-2 project with all dependent jars from parent?</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.
 

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