I have the following 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>
When I run mvn package
the resulting repackaged war file contains the original war itself under WEB-INF/lib/CalendarPortlet-2.6.2.war
.
Why does spring-boot add the war during repackaging and how do I prevent this?
In my real project I want to replace some resources of an already existing war and add the build-info for display by the actuator. But doubling the size of the artifact is not feasible just for that.
EDIT:
The problem also appears when repackaging jars.
Preventing the original artifact being included in the repackaged artifact can be achieved by manually specifying an exlclude for that artifact in the config of the spring-boot-maven plugin:
<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>
But I still don't know why that plugin includes the original artifact in the repackaged one.