Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
210438ee
Commit
210438ee
authored
Jan 07, 2021
by
Scott Frederick
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.3.x' into 2.4.x
Closes gh-24689
parents
ef7a8275
a302238e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
24 deletions
+67
-24
AbstractPackagerMojo.java
.../org/springframework/boot/maven/AbstractPackagerMojo.java
+25
-23
RepackageMojo.java
...in/java/org/springframework/boot/maven/RepackageMojo.java
+42
-1
No files found.
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractPackagerMojo.java
View file @
210438ee
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -54,6 +54,7 @@ import org.springframework.boot.loader.tools.layer.CustomLayers;
* Abstract base class for classes that work with an {@link Packager}.
*
* @author Phillip Webb
* @author Scott Frederick
* @since 2.3.0
*/
public
abstract
class
AbstractPackagerMojo
extends
AbstractDependencyFilterMojo
{
...
...
@@ -89,24 +90,6 @@ public abstract class AbstractPackagerMojo extends AbstractDependencyFilterMojo
@Parameter
private
String
mainClass
;
/**
* The type of archive (which corresponds to how the dependencies are laid out inside
* it). Possible values are {@code JAR}, {@code WAR}, {@code ZIP}, {@code DIR},
* {@code NONE}. Defaults to a guess based on the archive type.
* @since 1.0.0
*/
@Parameter
(
property
=
"spring-boot.repackage.layout"
)
private
LayoutType
layout
;
/**
* The layout factory that will be used to create the executable archive if no
* explicit layout is set. Alternative layouts implementations can be provided by 3rd
* parties.
* @since 1.5.0
*/
@Parameter
private
LayoutFactory
layoutFactory
;
/**
* Exclude Spring Boot devtools from the repackaged archive.
* @since 1.3.0
...
...
@@ -129,6 +112,24 @@ public abstract class AbstractPackagerMojo extends AbstractDependencyFilterMojo
@Parameter
private
Layers
layers
;
/**
* Return the type of archive that should be packaged by this MOJO.
* @return {@code null}, indicating a layout type will be chosen based on the original
* archive type
*/
protected
LayoutType
getLayout
()
{
return
null
;
}
/**
* Return the layout factory that will be used to determine the {@link LayoutType} if
* no explicit layout is set.
* @return {@code null}, indicating a default layout factory will be chosen
*/
protected
LayoutFactory
getLayoutFactory
()
{
return
null
;
}
/**
* Return a {@link Packager} configured for this MOJO.
* @param <P> the packager type
...
...
@@ -137,12 +138,13 @@ public abstract class AbstractPackagerMojo extends AbstractDependencyFilterMojo
*/
protected
<
P
extends
Packager
>
P
getConfiguredPackager
(
Supplier
<
P
>
supplier
)
{
P
packager
=
supplier
.
get
();
packager
.
setLayoutFactory
(
this
.
layoutFactory
);
packager
.
setLayoutFactory
(
getLayoutFactory
()
);
packager
.
addMainClassTimeoutWarningListener
(
new
LoggingMainClassTimeoutWarningListener
(
this
::
getLog
));
packager
.
setMainClass
(
this
.
mainClass
);
if
(
this
.
layout
!=
null
)
{
getLog
().
info
(
"Layout: "
+
this
.
layout
);
packager
.
setLayout
(
this
.
layout
.
layout
());
LayoutType
layout
=
getLayout
();
if
(
layout
!=
null
)
{
getLog
().
info
(
"Layout: "
+
layout
);
packager
.
setLayout
(
layout
.
layout
());
}
if
(
this
.
layers
==
null
)
{
packager
.
setLayers
(
IMPLICIT_LAYERS
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java
View file @
210438ee
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -36,6 +36,7 @@ import org.apache.maven.plugins.annotations.ResolutionScope;
import
org.springframework.boot.loader.tools.DefaultLaunchScript
;
import
org.springframework.boot.loader.tools.LaunchScript
;
import
org.springframework.boot.loader.tools.LayoutFactory
;
import
org.springframework.boot.loader.tools.Libraries
;
import
org.springframework.boot.loader.tools.Repackager
;
...
...
@@ -48,6 +49,7 @@ import org.springframework.boot.loader.tools.Repackager;
* @author Dave Syer
* @author Stephane Nicoll
* @author Björn Lindström
* @author Scott Frederick
* @since 1.0.0
*/
@Mojo
(
name
=
"repackage"
,
defaultPhase
=
LifecyclePhase
.
PACKAGE
,
requiresProject
=
true
,
threadSafe
=
true
,
...
...
@@ -152,6 +154,45 @@ public class RepackageMojo extends AbstractPackagerMojo {
@Parameter
(
defaultValue
=
"${project.build.outputTimestamp}"
)
private
String
outputTimestamp
;
/**
* The type of archive (which corresponds to how the dependencies are laid out inside
* it). Possible values are {@code JAR}, {@code WAR}, {@code ZIP}, {@code DIR},
* {@code NONE}. Defaults to a guess based on the archive type.
* @since 1.0.0
*/
@Parameter
(
property
=
"spring-boot.repackage.layout"
)
private
LayoutType
layout
;
/**
* The layout factory that will be used to create the executable archive if no
* explicit layout is set. Alternative layouts implementations can be provided by 3rd
* parties.
* @since 1.5.0
*/
@Parameter
private
LayoutFactory
layoutFactory
;
/**
* Return the type of archive that should be packaged by this MOJO.
* @return the value of the {@code layout} parameter, or {@code null} if the parameter
* is not provided
*/
@Override
protected
LayoutType
getLayout
()
{
return
this
.
layout
;
}
/**
* Return the layout factory that will be used to determine the {@link LayoutType} if
* no explicit layout is set.
* @return the value of the {@code layoutFactory} parameter, or {@code null} if the
* parameter is not provided
*/
@Override
protected
LayoutFactory
getLayoutFactory
()
{
return
this
.
layoutFactory
;
}
@Override
public
void
execute
()
throws
MojoExecutionException
,
MojoFailureException
{
if
(
this
.
project
.
getPackaging
().
equals
(
"pom"
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment