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
980b83c0
Commit
980b83c0
authored
Jul 14, 2017
by
Misagh Moayyed
Committed by
Andy Wilkinson
Jul 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Locate additional metadata when using Gradle 4
Closes gh-9758
parent
aedeaa94
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
MetadataStore.java
...gframework/boot/configurationprocessor/MetadataStore.java
+21
-5
No files found.
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java
View file @
980b83c0
...
...
@@ -110,18 +110,34 @@ public class MetadataStore {
private
InputStream
getAdditionalMetadataStream
()
throws
IOException
{
// Most build systems will have copied the file to the class output location
FileObject
fileObject
=
this
.
environment
.
getFiler
()
.
getResource
(
StandardLocation
.
CLASS_OUTPUT
,
""
,
ADDITIONAL_METADATA_PATH
);
FileObject
fileObject
=
this
.
environment
.
getFiler
()
.
getResource
(
StandardLocation
.
CLASS_OUTPUT
,
""
,
ADDITIONAL_METADATA_PATH
);
File
file
=
new
File
(
fileObject
.
toUri
());
if
(!
file
.
exists
())
{
// Gradle keeps things separate
String
path
=
file
.
getPath
();
int
index
=
path
.
lastIndexOf
(
CLASSES_FOLDER
);
if
(
index
>=
0
)
{
path
=
path
.
substring
(
0
,
index
)
+
RESOURCES_FOLDER
+
path
.
substring
(
index
+
CLASSES_FOLDER
.
length
());
file
=
new
File
(
path
);
/*
Gradle 4 introduces a new 'java' directory which causes issues for one-to-one path mapping
of class locations and resources. Ensure resources can be found under '/build/resources/main'
rather than '/build/resources/java/main'.
*/
final
String
pathBeforeClassFolder
=
path
.
substring
(
0
,
index
);
/*
In order to retrieve the the class output resource, we MUST pass in a relative path.
An empty path causes a InvalidArgumentException as it must be resolvable. In reality,
this means nothing since we are going to traverse upstream to its parent to locate
the 'main' directory.
*/
FileObject
classOutputLocation
=
this
.
environment
.
getFiler
().
getResource
(
StandardLocation
.
CLASS_OUTPUT
,
""
,
"dummy"
);
File
classesFolder
=
new
File
(
classOutputLocation
.
toUri
());
File
resourcesFolder
=
new
File
(
pathBeforeClassFolder
+
RESOURCES_FOLDER
+
'/'
+
classesFolder
.
getParentFile
().
getName
());
file
=
new
File
(
resourcesFolder
,
ADDITIONAL_METADATA_PATH
);
}
}
return
(
file
.
exists
()
?
new
FileInputStream
(
file
)
:
fileObject
.
toUri
().
toURL
().
openStream
());
...
...
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