repackage failed: Source file must be provided异常

When running spring-boot: repackage

~/Desktop/MyProject/springboot$ mvn spring-boot:repackage

An exception will occur:
Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:2.2.5.RELEASE:repackage failed: Source file must be provided

Analysis process:
During the execution of spring-boot: repackage, first read the packaged jar file, then make the necessary startup settings, and finally output the executable jar file. The exception should be the failure to read the jar file packaged by the mvn package.

Solution:

~/Desktop/MyProject/springboot$ mvn package spring-boot:repackage

Repacked successfully!

Since spring-boot: repackage is the default goal of Spring Boot Maven Plugin, I tried mvn package again and found that the executable jar file was also output.
Therefore, in order to repackage the jar file executable by Spring Boot, avoid directly executing mvn spring-boot: repackage. Just execute mvn package spring-boot: repackage or mvn package.

Published 381 original articles · praised 85 · 80,000 views +

Guess you like

Origin blog.csdn.net/weixin_40763897/article/details/105048517