Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Yes, you can :) It's done by identifying one WAR module as the primary, copying all the other WARs into the primary's target dir, making a jetty.xml and telling Maven Jetty Plugin to use the jetty.xml. Here's how to copy the other WARs using Maven dependency plugin:</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;copy&lt;/id&gt; &lt;phase&gt;package&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;copy&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;artifactItems&gt; &lt;artifactItem&gt; &lt;groupId&gt;com.foo&lt;/groupId&gt; &lt;artifactId&gt;bar&lt;/artifactId&gt; &lt;version&gt;${project.version}&lt;/version&gt; &lt;type&gt;war&lt;/type&gt; &lt;overWrite&gt;true&lt;/overWrite&gt; &lt;outputDirectory&gt;target/&lt;/outputDirectory&gt; &lt;/artifactItem&gt; &lt;/artifactItems&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; </code></pre> <p></p> <p>You'll need to have the com.foo:bar dependency defined in the POM as well. Here's the contents of jetty.xml:</p> <pre><code>&lt;?xml version="1.0"?&gt; </code></pre> <p></p> <pre><code>&lt;!-- =========================================================== --&gt; &lt;!-- Set handler Collection Structure --&gt; &lt;!-- =========================================================== --&gt; &lt;Set name="handler"&gt; &lt;New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection"&gt; &lt;Set name="handlers"&gt; &lt;Array type="org.eclipse.jetty.server.Handler"&gt; &lt;Item&gt; &lt;New class="org.eclipse.jetty.server.handler.ContextHandlerCollection" id="Contexts"&gt; &lt;Set name="handlers"&gt; &lt;Array type="org.eclipse.jetty.server.Handler"&gt; &lt;Item&gt; &lt;New id="FooWebHandler" class="org.eclipse.jetty.webapp.WebAppContext"/&gt; &lt;/Item&gt; &lt;/Array&gt; &lt;/Set&gt; &lt;/New&gt; &lt;/Item&gt; &lt;/Array&gt; &lt;/Set&gt; &lt;/New&gt; &lt;/Set&gt; &lt;Ref id="FooWebHandler"&gt; &lt;Set name="contextPath"&gt;/foo&lt;/Set&gt; &lt;Set name="war"&gt; target/bar-${project.version}.war &lt;/Set&gt; &lt;/Ref&gt; </code></pre> <p></p> <p>And here's how to tell Maven Jetty plugin to use the new jetty.xml:</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt; &lt;artifactId&gt;jetty-maven-plugin&lt;/artifactId&gt; &lt;version&gt;${jetty.version}&lt;/version&gt; &lt;configuration&gt; &lt;jettyConfig&gt;${basedir}/jetty.xml&lt;/jettyConfig&gt; &lt;/configuration&gt; </code></pre> <p></p> <p>Now kick off jetty:run-war goal from Eclipse and you should see all WARs deploying in one Maven Jetty plugin instance. I run this from command line and it works there, YMMV with Eclipse.</p>
 

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