Merge branch '3.3.x'

Closes gh-41696
This commit is contained in:
Stéphane Nicoll
2024-08-05 16:29:32 +02:00
2 changed files with 8 additions and 0 deletions

View File

@@ -10,6 +10,10 @@ Packaging an executable archive is performed by the `repackage` goal, as shown i
include::example$packaging/repackage-pom.xml[tags=repackage]
----
WARNING: The `repackage` goal is not meant to be used alone on the command-line as it operates on the source
`jar` (or `war`) produced by the `package` phase.
To use this goal on the command-line, you must include the `package` phase: `mvn package spring-boot:repackage`.
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.
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.

View File

@@ -221,6 +221,10 @@ public class RepackageMojo extends AbstractPackagerMojo {
private void repackage() throws MojoExecutionException {
Artifact source = getSourceArtifact(this.classifier);
File target = getTargetFile(this.finalName, this.classifier, this.outputDirectory);
if (source.getFile() == null) {
throw new MojoExecutionException(
"Source file is not available, make sure 'package' runs as part of the same lifecycle");
}
Repackager repackager = getRepackager(source.getFile());
Libraries libraries = getLibraries(this.requiresUnpack);
try {