Maven overlays and jetty plugin

1.4k views Asked by At

I am using Maven overlays and include a dependent war in pom as follows

<dependency>
  <groupId>com.test.dependent</groupId>
  <artifactId>dependent</artifactId>
  <version>1.0-SNAPSHOT</version>
  <type>war</type>
  <scope>runtime</scope>
</dependency>

The generated war files looks fine, it contains the resources out of both projects and if I deploy it to my tomcat server everything works as expected.

However I am used to use to jetty plugin in maven and run my builds with goal jetty:run

<build>
  <plugins>
    <plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.10</version>
    </plugin>
   </plugins>
  <finalName>myproject</finalName>
</build>

Unfortunately it looks like jetty would not include the files from the dependent project. How can I configure the plugin to take the dependent projects into account?

2

There are 2 answers

5
mikołak On

I wasn't aware that the maven-war-plugin packages overlays automatically (I always add an explicit <overlays> section to the config), but if that's true, simply running mvn package jetty:run should work, since jetty:run also checks the target directory.

0
Anton On

On Jetty 7.0.2 and higher you can use jetty:run with unpackOverlays configuration:

<webAppConfig>
    ...
    <unpackOverlays>true</unpackOverlays>
    ...        
</webAppConfig>

On Jetty 6, your only option is to use jetty:run-war for that.