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
514aede9
Commit
514aede9
authored
Feb 10, 2021
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.4.x'
Closes gh-25168
parents
d4365214
45e6c12c
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
48 additions
and
19 deletions
+48
-19
BootJar.java
...g/springframework/boot/gradle/tasks/bundling/BootJar.java
+6
-4
BootWar.java
...g/springframework/boot/gradle/tasks/bundling/BootWar.java
+4
-3
ResolvedDependencies.java
...work/boot/gradle/tasks/bundling/ResolvedDependencies.java
+9
-7
AbstractBootArchiveIntegrationTests.java
...e/tasks/bundling/AbstractBootArchiveIntegrationTests.java
+7
-3
BootJarTests.java
...ingframework/boot/gradle/tasks/bundling/BootJarTests.java
+1
-1
BootWarTests.java
...ingframework/boot/gradle/tasks/bundling/BootWarTests.java
+1
-1
BootJarIntegrationTests-multiModuleCustomLayers.gradle
...ng/BootJarIntegrationTests-multiModuleCustomLayers.gradle
+5
-0
BootJarIntegrationTests-multiModuleImplicitLayers.gradle
.../BootJarIntegrationTests-multiModuleImplicitLayers.gradle
+5
-0
BootWarIntegrationTests-multiModuleCustomLayers.gradle
...ng/BootWarIntegrationTests-multiModuleCustomLayers.gradle
+5
-0
BootWarIntegrationTests-multiModuleImplicitLayers.gradle
.../BootWarIntegrationTests-multiModuleImplicitLayers.gradle
+5
-0
No files found.
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java
View file @
514aede9
...
@@ -22,6 +22,7 @@ import java.util.concurrent.Callable;
...
@@ -22,6 +22,7 @@ import java.util.concurrent.Callable;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
org.gradle.api.Action
;
import
org.gradle.api.Action
;
import
org.gradle.api.Project
;
import
org.gradle.api.artifacts.ResolvableDependencies
;
import
org.gradle.api.artifacts.ResolvableDependencies
;
import
org.gradle.api.file.CopySpec
;
import
org.gradle.api.file.CopySpec
;
import
org.gradle.api.file.FileCollection
;
import
org.gradle.api.file.FileCollection
;
...
@@ -72,15 +73,16 @@ public class BootJar extends Jar implements BootArchive {
...
@@ -72,15 +73,16 @@ public class BootJar extends Jar implements BootArchive {
*/
*/
public
BootJar
()
{
public
BootJar
()
{
this
.
support
=
new
BootArchiveSupport
(
LAUNCHER
,
new
LibrarySpec
(),
new
ZipCompressionResolver
());
this
.
support
=
new
BootArchiveSupport
(
LAUNCHER
,
new
LibrarySpec
(),
new
ZipCompressionResolver
());
this
.
bootInfSpec
=
getProject
().
copySpec
().
into
(
"BOOT-INF"
);
Project
project
=
getProject
();
this
.
mainClass
=
getProject
().
getObjects
().
property
(
String
.
class
);
this
.
bootInfSpec
=
project
.
copySpec
().
into
(
"BOOT-INF"
);
this
.
mainClass
=
project
.
getObjects
().
property
(
String
.
class
);
configureBootInfSpec
(
this
.
bootInfSpec
);
configureBootInfSpec
(
this
.
bootInfSpec
);
getMainSpec
().
with
(
this
.
bootInfSpec
);
getMainSpec
().
with
(
this
.
bootInfSpec
);
getProject
()
.
getConfigurations
().
all
((
configuration
)
->
{
project
.
getConfigurations
().
all
((
configuration
)
->
{
ResolvableDependencies
incoming
=
configuration
.
getIncoming
();
ResolvableDependencies
incoming
=
configuration
.
getIncoming
();
incoming
.
afterResolve
((
resolvableDependencies
)
->
{
incoming
.
afterResolve
((
resolvableDependencies
)
->
{
if
(
resolvableDependencies
==
incoming
)
{
if
(
resolvableDependencies
==
incoming
)
{
this
.
resolvedDependencies
.
processConfiguration
(
configuration
);
this
.
resolvedDependencies
.
processConfiguration
(
project
,
configuration
);
}
}
});
});
});
});
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java
View file @
514aede9
...
@@ -70,15 +70,16 @@ public class BootWar extends War implements BootArchive {
...
@@ -70,15 +70,16 @@ public class BootWar extends War implements BootArchive {
*/
*/
public
BootWar
()
{
public
BootWar
()
{
this
.
support
=
new
BootArchiveSupport
(
LAUNCHER
,
new
LibrarySpec
(),
new
ZipCompressionResolver
());
this
.
support
=
new
BootArchiveSupport
(
LAUNCHER
,
new
LibrarySpec
(),
new
ZipCompressionResolver
());
this
.
mainClass
=
getProject
().
getObjects
().
property
(
String
.
class
);
Project
project
=
getProject
();
this
.
mainClass
=
project
.
getObjects
().
property
(
String
.
class
);
getWebInf
().
into
(
"lib-provided"
,
fromCallTo
(
this
::
getProvidedLibFiles
));
getWebInf
().
into
(
"lib-provided"
,
fromCallTo
(
this
::
getProvidedLibFiles
));
this
.
support
.
moveModuleInfoToRoot
(
getRootSpec
());
this
.
support
.
moveModuleInfoToRoot
(
getRootSpec
());
getRootSpec
().
eachFile
(
this
.
support
::
excludeNonZipLibraryFiles
);
getRootSpec
().
eachFile
(
this
.
support
::
excludeNonZipLibraryFiles
);
getProject
()
.
getConfigurations
().
all
((
configuration
)
->
{
project
.
getConfigurations
().
all
((
configuration
)
->
{
ResolvableDependencies
incoming
=
configuration
.
getIncoming
();
ResolvableDependencies
incoming
=
configuration
.
getIncoming
();
incoming
.
afterResolve
((
resolvableDependencies
)
->
{
incoming
.
afterResolve
((
resolvableDependencies
)
->
{
if
(
resolvableDependencies
==
incoming
)
{
if
(
resolvableDependencies
==
incoming
)
{
this
.
resolvedDependencies
.
processConfiguration
(
configuration
);
this
.
resolvedDependencies
.
processConfiguration
(
project
,
configuration
);
}
}
});
});
});
});
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/ResolvedDependencies.java
View file @
514aede9
/*
/*
* 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");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -22,9 +22,9 @@ import java.util.Map;
...
@@ -22,9 +22,9 @@ import java.util.Map;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
org.gradle.api.Project
;
import
org.gradle.api.artifacts.Configuration
;
import
org.gradle.api.artifacts.Configuration
;
import
org.gradle.api.artifacts.ModuleVersionIdentifier
;
import
org.gradle.api.artifacts.ModuleVersionIdentifier
;
import
org.gradle.api.artifacts.ProjectDependency
;
import
org.gradle.api.artifacts.ResolvedArtifact
;
import
org.gradle.api.artifacts.ResolvedArtifact
;
import
org.gradle.api.artifacts.ResolvedConfiguration
;
import
org.gradle.api.artifacts.ResolvedConfiguration
;
...
@@ -44,13 +44,15 @@ class ResolvedDependencies {
...
@@ -44,13 +44,15 @@ class ResolvedDependencies {
private
final
Map
<
Configuration
,
ResolvedConfigurationDependencies
>
configurationDependencies
=
new
LinkedHashMap
<>();
private
final
Map
<
Configuration
,
ResolvedConfigurationDependencies
>
configurationDependencies
=
new
LinkedHashMap
<>();
void
processConfiguration
(
Configuration
configuration
)
{
private
String
projectId
(
Project
project
)
{
Set
<
String
>
projectDependencyIds
=
configuration
.
getAllDependencies
().
withType
(
ProjectDependency
.
class
).
stream
()
return
project
.
getGroup
()
+
":"
+
project
.
getName
()
+
":"
+
project
.
getVersion
();
.
map
((
projectDependency
)
->
projectDependency
.
getGroup
()
+
":"
+
projectDependency
.
getName
()
+
":"
}
+
projectDependency
.
getVersion
())
void
processConfiguration
(
Project
project
,
Configuration
configuration
)
{
Set
<
String
>
localProjectIds
=
project
.
getRootProject
().
getAllprojects
().
stream
().
map
(
this
::
projectId
)
.
collect
(
Collectors
.
toSet
());
.
collect
(
Collectors
.
toSet
());
this
.
configurationDependencies
.
put
(
configuration
,
this
.
configurationDependencies
.
put
(
configuration
,
new
ResolvedConfigurationDependencies
(
projectDependency
Ids
,
configuration
.
getResolvedConfiguration
()));
new
ResolvedConfigurationDependencies
(
localProject
Ids
,
configuration
.
getResolvedConfiguration
()));
}
}
DependencyDescriptor
find
(
File
file
)
{
DependencyDescriptor
find
(
File
file
)
{
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java
View file @
514aede9
...
@@ -326,6 +326,7 @@ abstract class AbstractBootArchiveIntegrationTests {
...
@@ -326,6 +326,7 @@ abstract class AbstractBootArchiveIntegrationTests {
assertThat
(
jarFile
.
getEntry
(
layerToolsJar
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
layerToolsJar
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"alpha-1.2.3.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"alpha-1.2.3.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"bravo-1.2.3.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"bravo-1.2.3.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"charlie-1.2.3.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"commons-lang3-3.9.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"commons-lang3-3.9.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"spring-core-5.2.5.RELEASE.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"spring-core-5.2.5.RELEASE.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"spring-jcl-5.2.5.RELEASE.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"spring-jcl-5.2.5.RELEASE.jar"
)).
isNotNull
();
...
@@ -347,8 +348,9 @@ abstract class AbstractBootArchiveIntegrationTests {
...
@@ -347,8 +348,9 @@ abstract class AbstractBootArchiveIntegrationTests {
assertThat
(
indexedLayers
.
get
(
"dependencies"
)).
containsExactlyElementsOf
(
expectedDependencies
);
assertThat
(
indexedLayers
.
get
(
"dependencies"
)).
containsExactlyElementsOf
(
expectedDependencies
);
assertThat
(
indexedLayers
.
get
(
"spring-boot-loader"
)).
containsExactly
(
"org/"
);
assertThat
(
indexedLayers
.
get
(
"spring-boot-loader"
)).
containsExactly
(
"org/"
);
assertThat
(
indexedLayers
.
get
(
"snapshot-dependencies"
)).
containsExactlyElementsOf
(
expectedSnapshotDependencies
);
assertThat
(
indexedLayers
.
get
(
"snapshot-dependencies"
)).
containsExactlyElementsOf
(
expectedSnapshotDependencies
);
assertThat
(
indexedLayers
.
get
(
"application"
)).
containsExactly
(
getExpectedApplicationLayerContents
(
assertThat
(
indexedLayers
.
get
(
"application"
))
this
.
classesPath
,
this
.
libPath
+
"alpha-1.2.3.jar"
,
this
.
libPath
+
"bravo-1.2.3.jar"
));
.
containsExactly
(
getExpectedApplicationLayerContents
(
this
.
classesPath
,
this
.
libPath
+
"alpha-1.2.3.jar"
,
this
.
libPath
+
"bravo-1.2.3.jar"
,
this
.
libPath
+
"charlie-1.2.3.jar"
));
BuildResult
listLayers
=
this
.
gradleBuild
.
build
(
"listLayers"
);
BuildResult
listLayers
=
this
.
gradleBuild
.
build
(
"listLayers"
);
assertThat
(
listLayers
.
task
(
":listLayers"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
listLayers
.
task
(
":listLayers"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
String
listLayersOutput
=
listLayers
.
getOutput
();
String
listLayersOutput
=
listLayers
.
getOutput
();
...
@@ -417,6 +419,7 @@ abstract class AbstractBootArchiveIntegrationTests {
...
@@ -417,6 +419,7 @@ abstract class AbstractBootArchiveIntegrationTests {
assertThat
(
jarFile
.
getEntry
(
layerToolsJar
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
layerToolsJar
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"alpha-1.2.3.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"alpha-1.2.3.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"bravo-1.2.3.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"bravo-1.2.3.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"charlie-1.2.3.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"commons-lang3-3.9.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"commons-lang3-3.9.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"spring-core-5.2.5.RELEASE.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"spring-core-5.2.5.RELEASE.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"spring-jcl-5.2.5.RELEASE.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
this
.
libPath
+
"spring-jcl-5.2.5.RELEASE.jar"
)).
isNotNull
();
...
@@ -432,6 +435,7 @@ abstract class AbstractBootArchiveIntegrationTests {
...
@@ -432,6 +435,7 @@ abstract class AbstractBootArchiveIntegrationTests {
Set
<
String
>
expectedSubprojectDependencies
=
new
TreeSet
<>();
Set
<
String
>
expectedSubprojectDependencies
=
new
TreeSet
<>();
expectedSubprojectDependencies
.
add
(
this
.
libPath
+
"alpha-1.2.3.jar"
);
expectedSubprojectDependencies
.
add
(
this
.
libPath
+
"alpha-1.2.3.jar"
);
expectedSubprojectDependencies
.
add
(
this
.
libPath
+
"bravo-1.2.3.jar"
);
expectedSubprojectDependencies
.
add
(
this
.
libPath
+
"bravo-1.2.3.jar"
);
expectedSubprojectDependencies
.
add
(
this
.
libPath
+
"charlie-1.2.3.jar"
);
Set
<
String
>
expectedDependencies
=
new
TreeSet
<>();
Set
<
String
>
expectedDependencies
=
new
TreeSet
<>();
expectedDependencies
.
add
(
this
.
libPath
+
"spring-core-5.2.5.RELEASE.jar"
);
expectedDependencies
.
add
(
this
.
libPath
+
"spring-core-5.2.5.RELEASE.jar"
);
expectedDependencies
.
add
(
this
.
libPath
+
"spring-jcl-5.2.5.RELEASE.jar"
);
expectedDependencies
.
add
(
this
.
libPath
+
"spring-jcl-5.2.5.RELEASE.jar"
);
...
@@ -492,7 +496,7 @@ abstract class AbstractBootArchiveIntegrationTests {
...
@@ -492,7 +496,7 @@ abstract class AbstractBootArchiveIntegrationTests {
private
void
writeSettingsGradle
()
{
private
void
writeSettingsGradle
()
{
try
(
PrintWriter
writer
=
new
PrintWriter
(
try
(
PrintWriter
writer
=
new
PrintWriter
(
new
FileWriter
(
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"settings.gradle"
))))
{
new
FileWriter
(
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"settings.gradle"
))))
{
writer
.
println
(
"include 'alpha', 'bravo'"
);
writer
.
println
(
"include 'alpha', 'bravo'
, 'charlie'
"
);
}
}
catch
(
IOException
ex
)
{
catch
(
IOException
ex
)
{
throw
new
RuntimeException
(
ex
);
throw
new
RuntimeException
(
ex
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootJarTests.java
View file @
514aede9
...
@@ -116,7 +116,7 @@ class BootJarTests extends AbstractBootArchiveTests<BootJar> {
...
@@ -116,7 +116,7 @@ class BootJarTests extends AbstractBootArchiveTests<BootJar> {
@Override
@Override
void
populateResolvedDependencies
(
Configuration
configuration
)
{
void
populateResolvedDependencies
(
Configuration
configuration
)
{
getTask
().
getResolvedDependencies
().
processConfiguration
(
configuration
);
getTask
().
getResolvedDependencies
().
processConfiguration
(
getTask
().
getProject
(),
configuration
);
}
}
@Override
@Override
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java
View file @
514aede9
...
@@ -116,7 +116,7 @@ class BootWarTests extends AbstractBootArchiveTests<BootWar> {
...
@@ -116,7 +116,7 @@ class BootWarTests extends AbstractBootArchiveTests<BootWar> {
@Override
@Override
void
populateResolvedDependencies
(
Configuration
configuration
)
{
void
populateResolvedDependencies
(
Configuration
configuration
)
{
getTask
().
getResolvedDependencies
().
processConfiguration
(
configuration
);
getTask
().
getResolvedDependencies
().
processConfiguration
(
getTask
().
getProject
(),
configuration
);
}
}
@Override
@Override
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-multiModuleCustomLayers.gradle
View file @
514aede9
...
@@ -7,6 +7,11 @@ subprojects {
...
@@ -7,6 +7,11 @@ subprojects {
apply
plugin:
'java'
apply
plugin:
'java'
group
=
'org.example.projects'
group
=
'org.example.projects'
version
=
'1.2.3'
version
=
'1.2.3'
if
(
it
.
name
==
'bravo'
)
{
dependencies
{
implementation
(
project
(
':charlie'
))
}
}
}
}
bootJar
{
bootJar
{
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-multiModuleImplicitLayers.gradle
View file @
514aede9
...
@@ -7,6 +7,11 @@ subprojects {
...
@@ -7,6 +7,11 @@ subprojects {
apply
plugin:
'java'
apply
plugin:
'java'
group
=
'org.example.projects'
group
=
'org.example.projects'
version
=
'1.2.3'
version
=
'1.2.3'
if
(
it
.
name
==
'bravo'
)
{
dependencies
{
implementation
(
project
(
':charlie'
))
}
}
}
}
bootJar
{
bootJar
{
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests-multiModuleCustomLayers.gradle
View file @
514aede9
...
@@ -8,6 +8,11 @@ subprojects {
...
@@ -8,6 +8,11 @@ subprojects {
apply
plugin:
'java'
apply
plugin:
'java'
group
=
'org.example.projects'
group
=
'org.example.projects'
version
=
'1.2.3'
version
=
'1.2.3'
if
(
it
.
name
==
'bravo'
)
{
dependencies
{
implementation
(
project
(
':charlie'
))
}
}
}
}
bootWar
{
bootWar
{
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests-multiModuleImplicitLayers.gradle
View file @
514aede9
...
@@ -8,6 +8,11 @@ subprojects {
...
@@ -8,6 +8,11 @@ subprojects {
apply
plugin:
'java'
apply
plugin:
'java'
group
=
'org.example.projects'
group
=
'org.example.projects'
version
=
'1.2.3'
version
=
'1.2.3'
if
(
it
.
name
==
'bravo'
)
{
dependencies
{
implementation
(
project
(
':charlie'
))
}
}
}
}
bootWar
{
bootWar
{
...
...
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