Skip to content

Commit 90f847d

Browse files
committed
Merge branch '3.3.x'
Closes gh-41696
2 parents 8bff866 + 7607bf1 commit 90f847d

File tree

2 files changed

+8
-0
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src

2 files changed

+8
-0
lines changed

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/packaging.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Packaging an executable archive is performed by the `repackage` goal, as shown i
1010
include::example$packaging/repackage-pom.xml[tags=repackage]
1111
----
1212

13+
WARNING: The `repackage` goal is not meant to be used alone on the command-line as it operates on the source
14+
`jar` (or `war`) produced by the `package` phase.
15+
To use this goal on the command-line, you must include the `package` phase: `mvn package spring-boot:repackage`.
16+
1317
TIP: If you are using `spring-boot-starter-parent`, such execution is already pre-configured with a `repackage` execution ID so that only the plugin definition should be added.
1418

1519
The example above repackages a `jar` or `war` archive that is built during the package phase of the Maven lifecycle, including any `provided` dependencies that are defined in the project.

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ public void execute() throws MojoExecutionException, MojoFailureException {
221221
private void repackage() throws MojoExecutionException {
222222
Artifact source = getSourceArtifact(this.classifier);
223223
File target = getTargetFile(this.finalName, this.classifier, this.outputDirectory);
224+
if (source.getFile() == null) {
225+
throw new MojoExecutionException(
226+
"Source file is not available, make sure 'package' runs as part of the same lifecycle");
227+
}
224228
Repackager repackager = getRepackager(source.getFile());
225229
Libraries libraries = getLibraries(this.requiresUnpack);
226230
try {

0 commit comments

Comments
 (0)