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
"value getOffsetStatic is not a member of object scala.runtime.LazyVals" while testing Java-only library with ScalaTest + Scala 3.4.1 #7553
Comments
@lespea Thanks for a report with repro project! |
So I am not exactly sure how it has worked in sbt 1.9.9, but looking at sbt 1.10.0:
The classpath shows scala3-library_3 3.1.3, and scala-library 2.13.8. I think sbt 1.10.0 not compiling is more correct behavior than sbt 1.9.9. |
🤔 hmm interesting. Good catch that it was using the older |
Oh I read your message too fast. Okay so the dependency list is the same in both cases so I don't think that's it? Are there some changes I need to make in the config so that it compiles? I'm guessing the issue is that no scala libs are being declared for build but in test it is using scala? And interesting it's saying the scala 3.1.3 library and not the one I declared, sbt 1.9.9
sbt 1.10.0
I double checked and there's no change to |
Normally sbt will try to include the right scala library (scala3-library, or scala-library) but you specified: autoScalaLibrary := false so it just picked whatever that was in the transitive dependency graph. |
Okay so I played with the build.sbt a bit and here are my findings:
Is there a way to make either of the Also sorry if there's already a better way of doing this I'm just missing. |
ok, so to clarify the goal here, you want to:
I think this "test Java library" was a blind spot of modern Scala 3.x and 2.13.x + sbt.
In the short term, my guess is that you'd have to manually add scala3-library, but we should add documentation around this, and perhaps try to implement |
Yeah that's basically my use case I guess I should have been more clear about that from the get-go. Sounds good if you can figure out an elegant way to make that work but for now I'll just add the dep as testing. Appreciate your help! |
That is the configuration of |
steps
Repo showing steps / code: https://github.com/lespea/sbt-1.10-issue
(steps supplementary provided by @eed3si9n)
autoScalaLibrary := false
on the subprojectproblem
Compiling project with
1.10.0
fails with. Works with1.9.9
expectation
Code continues to compile
workaround
Version info
sbt --version
sbt version in this project: 1.10.0
sbt script version: 1.10.0
uname -a
Darwin LMHWTM9L2H 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 arm64
java --version
openjdk 21.0.3 2024-04-16 LTS
OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode)
The text was updated successfully, but these errors were encountered: