简体   繁体   中英

Maven overlays and jetty plugin

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?

我不知道maven-war-plugin软件包会自动覆盖(我总是在配置中添加一个显式的<overlays>部分),但是如果是这样,那么只需运行mvn package jetty:run可以,因为jetty:run也可以检查目标目录。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM