maven-dependency-plugin 和 maven-war-plugin 之间的资源提取冲突?
Resources extraction conflict between maven-dependency-plugin and maven-war-plugin?
我曾经从依赖项中提取一些资源到我的项目的结果 WAR 中(作为覆盖)。但是由于我添加了对依赖项插件的解包目标的调用,所以似乎只有 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>
有没有人知道某个问题或看到我在这里做错了什么?
非常感谢任何帮助或建议。
我终于发现叠加可以处理不同的类型,所以这里是答案:
<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>
<overlay>
<groupId>com.xxx.custom.www.yyy</groupId>
<artifactId>www-yyy-etat</artifactId>
<type>zip</type>
<outputDirectory>WEB-INF/classes</outputDirectory>
</overlay>
</overlays>
</configuration>
</plugin>
不需要maven-dependency-plugin。
我曾经从依赖项中提取一些资源到我的项目的结果 WAR 中(作为覆盖)。但是由于我添加了对依赖项插件的解包目标的调用,所以似乎只有 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>
有没有人知道某个问题或看到我在这里做错了什么? 非常感谢任何帮助或建议。
我终于发现叠加可以处理不同的类型,所以这里是答案:
<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>
<overlay>
<groupId>com.xxx.custom.www.yyy</groupId>
<artifactId>www-yyy-etat</artifactId>
<type>zip</type>
<outputDirectory>WEB-INF/classes</outputDirectory>
</overlay>
</overlays>
</configuration>
</plugin>
不需要maven-dependency-plugin。