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
2f92261f
Commit
2f92261f
authored
Mar 11, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.2.x'
Closes gh-20502
parents
ad9e5be3
e937b2e0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
2 deletions
+46
-2
DependencyCustomizer.java
...ringframework/boot/cli/compiler/DependencyCustomizer.java
+3
-1
DependencyCustomizerTests.java
...ramework/boot/cli/compiler/DependencyCustomizerTests.java
+43
-1
resource1.txt
.../test/resources/dependency-customizer-tests/resource1.txt
+0
-0
resource2.txt
.../test/resources/dependency-customizer-tests/resource2.txt
+0
-0
No files found.
spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java
View file @
2f92261f
...
@@ -140,7 +140,9 @@ public class DependencyCustomizer {
...
@@ -140,7 +140,9 @@ public class DependencyCustomizer {
protected
boolean
canAdd
()
{
protected
boolean
canAdd
()
{
for
(
String
path
:
paths
)
{
for
(
String
path
:
paths
)
{
try
{
try
{
return
DependencyCustomizer
.
this
.
loader
.
getResource
(
path
)
!=
null
;
if
(
DependencyCustomizer
.
this
.
loader
.
getResource
(
path
)
==
null
)
{
return
false
;
}
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
// swallow exception and continue
// swallow exception and continue
...
...
spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/DependencyCustomizerTests.java
View file @
2f92261f
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
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.
...
@@ -138,6 +138,48 @@ class DependencyCustomizerTests {
...
@@ -138,6 +138,48 @@ class DependencyCustomizerTests {
assertThat
(
this
.
classNode
.
getAnnotations
(
new
ClassNode
(
Grab
.
class
))).
hasSize
(
1
);
assertThat
(
this
.
classNode
.
getAnnotations
(
new
ClassNode
(
Grab
.
class
))).
hasSize
(
1
);
}
}
@Test
void
allResourcesPresentWithAllResourcesPresentPerformsAdd
()
{
this
.
dependencyCustomizer
.
ifAllResourcesPresent
(
"dependency-customizer-tests/resource1.txt"
,
"dependency-customizer-tests/resource2.txt"
).
add
(
"spring-boot-starter-logging"
);
assertThat
(
this
.
classNode
.
getAnnotations
(
new
ClassNode
(
Grab
.
class
))).
hasSize
(
1
);
}
@Test
void
allResourcesPresentWithSomeResourcesPresentDoesNotPerformAdd
()
{
this
.
dependencyCustomizer
.
ifAllResourcesPresent
(
"dependency-customizer-tests/resource1.txt"
,
"dependency-customizer-tests/does-not-exist.txt"
).
add
(
"spring-boot-starter-logging"
);
assertThat
(
this
.
classNode
.
getAnnotations
(
new
ClassNode
(
Grab
.
class
))).
isEmpty
();
}
@Test
void
allResourcesPresentWithNoResourcesPresentDoesNotPerformAdd
()
{
this
.
dependencyCustomizer
.
ifAllResourcesPresent
(
"dependency-customizer-tests/does-not-exist"
,
"dependency-customizer-tests/does-not-exist-either.txt"
).
add
(
"spring-boot-starter-logging"
);
assertThat
(
this
.
classNode
.
getAnnotations
(
new
ClassNode
(
Grab
.
class
))).
isEmpty
();
}
@Test
void
anyResourcesPresentWithAllResourcesPresentPerformsAdd
()
{
this
.
dependencyCustomizer
.
ifAnyResourcesPresent
(
"dependency-customizer-tests/resource1.txt"
,
"dependency-customizer-tests/resource2.txt"
).
add
(
"spring-boot-starter-logging"
);
assertThat
(
this
.
classNode
.
getAnnotations
(
new
ClassNode
(
Grab
.
class
))).
hasSize
(
1
);
}
@Test
void
anyResourcesPresentWithSomeResourcesPresentPerforms
()
{
this
.
dependencyCustomizer
.
ifAnyResourcesPresent
(
"dependency-customizer-tests/resource1.txt"
,
"dependency-customizer-tests/does-not-exist.txt"
).
add
(
"spring-boot-starter-logging"
);
assertThat
(
this
.
classNode
.
getAnnotations
(
new
ClassNode
(
Grab
.
class
))).
hasSize
(
1
);
}
@Test
void
anyResourcesPresentWithNoResourcesPresentDoesNotPerformAdd
()
{
this
.
dependencyCustomizer
.
ifAnyResourcesPresent
(
"dependency-customizer-tests/does-not-exist"
,
"dependency-customizer-tests/does-not-exist-either.txt"
).
add
(
"spring-boot-starter-logging"
);
assertThat
(
this
.
classNode
.
getAnnotations
(
new
ClassNode
(
Grab
.
class
))).
isEmpty
();
}
private
void
assertGrabAnnotation
(
AnnotationNode
annotationNode
,
String
group
,
String
module
,
String
version
,
private
void
assertGrabAnnotation
(
AnnotationNode
annotationNode
,
String
group
,
String
module
,
String
version
,
String
classifier
,
String
type
,
boolean
transitive
)
{
String
classifier
,
String
type
,
boolean
transitive
)
{
assertThat
(
getMemberValue
(
annotationNode
,
"group"
)).
isEqualTo
(
group
);
assertThat
(
getMemberValue
(
annotationNode
,
"group"
)).
isEqualTo
(
group
);
...
...
spring-boot-project/spring-boot-cli/src/test/resources/dependency-customizer-tests/resource1.txt
0 → 100644
View file @
2f92261f
spring-boot-project/spring-boot-cli/src/test/resources/dependency-customizer-tests/resource2.txt
0 → 100644
View file @
2f92261f
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