Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Simplify project configuration. Separate java source code from <code>WAR</code> to <code>JAR</code>. After this you can simply add this <code>JAR</code> to another <code>WAR</code> as dependency. <em>Merging</em> java code in this case is not good idea. </p> <p>For merging resources from <code>WAR</code> use maven <a href="http://maven.apache.org/plugins/maven-war-plugin/overlays.html" rel="nofollow">overlays</a>.</p> <h2>Sample solution</h2> <pre><code>* test-parent.pom * test-core (test-core.jar) - shared code * test-web-parent (test-web-parent.pom) - first project * core (test-web-core.jar) * web (test-web.war) * test-web-2-parent (test-web-2-parent.pom) - second project * core (test-web-2-core.jar) * web (test-web-2.war) </code></pre> <p><code>test-web.war</code> have dependencies:</p> <ul> <li>test-web-core.jar</li> <li>test-core.jar</li> </ul> <p><code>test-web-2.war</code> have dependencies:</p> <ul> <li>test-web-2-core.jar</li> <li>test-core.jar</li> </ul> <h1>Configuration</h1> <h2><code>test-parent.pom</code></h2> <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;packaging&gt;pom&lt;/packaging&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;modules&gt; &lt;module&gt;test-core&lt;/module&gt; &lt;module&gt;test-web-parent&lt;/module&gt; &lt;module&gt;test-web-2-parent&lt;/module&gt; &lt;/modules&gt; &lt;/project&gt; </code></pre> <h2><code>test-core.jar</code></h2> <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;parent&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-parent&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;/parent&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;artifactId&gt;test-core&lt;/artifactId&gt; &lt;/project&gt; </code></pre> <h2><code>test-web-parent.pom</code></h2> <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;parent&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-parent&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;/parent&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;artifactId&gt;test-web-parent&lt;/artifactId&gt; &lt;packaging&gt;pom&lt;/packaging&gt; &lt;modules&gt; &lt;module&gt;core&lt;/module&gt; &lt;module&gt;web&lt;/module&gt; &lt;/modules&gt; &lt;/project&gt; </code></pre> <h2><code>test-web-core.jar</code></h2> <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;parent&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-web-parent&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;/parent&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;artifactId&gt;test-web-core&lt;/artifactId&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-core&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/project&gt; </code></pre> <h2><code>test-web.war</code></h2> <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;parent&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-web-parent&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;/parent&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;artifactId&gt;test-web&lt;/artifactId&gt; &lt;packaging&gt;war&lt;/packaging&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-web-core&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;type&gt;jar&lt;/type&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/project&gt; </code></pre> <h2><code>test-web-2-parent.pom</code></h2> <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;parent&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-parent&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;/parent&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;artifactId&gt;test-web-2-parent&lt;/artifactId&gt; &lt;packaging&gt;pom&lt;/packaging&gt; &lt;modules&gt; &lt;module&gt;core&lt;/module&gt; &lt;module&gt;web&lt;/module&gt; &lt;/modules&gt; &lt;/project&gt; </code></pre> <h2><code>test-web-2-core.jar</code></h2> <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;parent&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-web-2-parent&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;/parent&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;artifactId&gt;test-web-2-core&lt;/artifactId&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-core&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/project&gt; </code></pre> <h2><code>test-web-2.war</code></h2> <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;parent&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-web-2-parent&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;/parent&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;artifactId&gt;test-web-2&lt;/artifactId&gt; &lt;packaging&gt;war&lt;/packaging&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-web-2-core&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;/dependency&gt; &lt;!--first war--&gt; &lt;dependency&gt; &lt;groupId&gt;test-parent&lt;/groupId&gt; &lt;artifactId&gt;test-web&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;scope&gt;runtime&lt;/scope&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-core&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/project&gt; </code></pre> <h2>Source code</h2> <ul> <li><a href="https://github.com/mariuszs/stackoverflow-war-bounty" rel="nofollow">https://github.com/mariuszs/stackoverflow-war-bounty</a></li> </ul>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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