Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing reading files in sbt 1.4+ subprojects #2668

Merged
merged 1 commit into from Dec 10, 2020

Conversation

mkurz
Copy link
Contributor

@mkurz mkurz commented Dec 5, 2020

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:

vf://tmp//home/mkurz/myproject/src/main/java/example/Main.java

instead of the format

vf://tmp/$%7BBASE%7D/src/main/java/example/Main.java

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.

@mkurz
Copy link
Contributor Author

mkurz commented Dec 9, 2020

@rzwitserloot Can you please have a look at this pull request before the next release? The sbt fix you provided unfortunately does not handle sbt subprojects yet. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants