【发布时间】:2019-07-19 17:01:24
【问题描述】:
我曾经将一些依赖项中的资源提取到我的项目生成的 WAR 中(作为覆盖)。但是由于我添加了对依赖项插件的 unpack 目标的调用,因此似乎只有 ZIP 存档中的资源被嵌入到该 WAR 中。
<groupId>com.xxx.custom.www.yyy</groupId>
<artifactId>www-yyy-war</artifactId>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.xxx.custom.www.yyy</groupId>
<artifactId>www-yyy-import</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.xxx.custom.www.yyy</groupId>
<artifactId>www-yyy-export</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.xxx.www</groupId>
<artifactId>www-server</artifactId>
<version>${www.version}</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<overlays>
<overlay />
<overlay>
<groupId>com.xxx.www</groupId>
<artifactId>www-server</artifactId>
<type>war</type>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
我想要的是将 ZIP 资源添加到现有资源中。但我最终只得到了 ZIP 资源,在这里。
<dependencies>
<dependency>
<groupId>com.xxx.custom.www.yyy</groupId>
<artifactId>www-yyy-etat</artifactId>
<version>${project.version}</version>
<type>zip</type>
</dependency>
...
</dependencies>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.xxx.custom.www.yyy</groupId>
<artifactId>www-xxx-etat</artifactId>
<version>${project.version}</version>
<type>zip</type>
<outputDirectory>${project.build.directory}/war/work/com.xxx.www/www-server/WEB-INF/classes</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
有没有人知道某个问题或看到我在这里做错了什么? 非常感谢您的任何帮助或建议。
【问题讨论】:
标签: maven dependencies war