Spring Boot 2.2.1 在构建时创建两个 jar

Spring Boot 2.2.1 Create two jar's while Build

我正在开发 Spring boot 版本 2.2.1.RELEASE。在构建我的项目时,将创建两个具有类型 executable jar fileoriginal file 的 jar,如下所示

原因是

Maven first builds my project and packages my classes and resources into a jar (${artifactId}.jar) file.

Then, repackaging happens. In this goal, all the dependencies mentioned in the pom.xml are packaged inside a new WAR (${artifactId}.jar) and the previously generated war is renamed to ${artifactId}.jar.original.

Pom.xml

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>  
              <executions>
                 <execution>
                     <goals>
                         <goal>repackage</goal>
                     </goals>
                 </execution>
             </executions>         
            <configuration>    
                <mainClass>com.data.MainService</mainClass>
            </configuration>
        </plugin>
    </plugins>
</build>

我们如何避免创建 ORIGINAL File 类型的 jar 文件。

maven 中是否有可用的禁用/排除技术。

我也试过关注<build>

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>                         
                <configuration>    
                    <mainClass>com.data.MainService</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>

根据实施,预计 jar.original。不用担心。

重新打包创建新的 jar 文件并将旧文件重命名为 jar.original

https://docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins.html#build-tool-plugins-repackage-implementation