Fixing reading files in sbt 1.4+ subprojects #2668
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I did some testing with the current edge release, and found a bug:
The fix for #2645 is not working when using sbt subprojects.
In my case I have a subproject, which pulls in and uses lombok, and a parent (root) project (which depends on the subproject).
Now when running sbt in the root project and start compiling that root project, which in turn also compiles the subproject, the
lombok.config
(located in the subproject) is, again, ignored, resulting in compiling errors in the subproject.After some debugging it turns out that the URI reported by sbt for the subproject has the format:
instead of the format
when using a normal, single root project with lombok.
That makes sense, because the files of the subproject are obviously not located within the root project (=
BASE
, where relative paths like${BASE}/src/main/java/example/Main.java
are used), therefore absolut paths are used (/home/mkurz/myproject/src/main/java/example/Main.java
).The fix is quite easy: When the file path doesn't start with
${
(when looking for${BASE}
), we can assume the path is very likely an absolute one, so we just use it.I can confirm this fixes our compiler errors and the app runs smoothly.