为什么 spring-boot-maven 插件在重新打包叠加的战争文件时会添加战争本身?



我有以下pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>foo-war</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.jasig.portlet</groupId>
<artifactId>CalendarPortlet</artifactId>
<version>2.6.2</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.6.RELEASE</version>
<executions>
<execution>
<goals>
<goal>build-info</goal>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<overlays>
<overlay>
<groupId>org.jasig.portlet</groupId>
<artifactId>CalendarPortlet</artifactId>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
</project>

当我运行mvn package时,生成的重新打包的战争文件包含WEB-INF/lib/CalendarPortlet-2.6.2.war下的原始战争本身。

为什么弹簧靴在重新包装时会增加战争,我该如何防止这种情况?

在我的实际项目中,我想替换已经存在的战争的一些资源,并添加构建信息以供执行器显示。但是,仅凭这一点,将工件的大小加倍是不可行的。

编辑:
重新包装罐子时也会出现问题。

通过在 spring-boot-maven 插件的配置中手动指定该工件的 exlclude,可以防止原始工件包含在重新打包的工件中:

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.6.RELEASE</version>
<configuration>
<excludes>
<exclude>
<groupId>org.jasig.portlet</groupId>
<artifactId>CalendarPortlet</artifactId>
</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>build-info</goal>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>

但我仍然不知道为什么该插件在重新打包的插件中包含原始工件。

最新更新