Intellij Idea sbt plugin with Java 11 modules

Hi, 

I'm managed to setup sbt with java 11 modules support (java.net.http) with simply adding 

scalacOptions ++= Seq(
"-J--add-modules", "-Jjava.net.http"
)

options to build.sbt, and it works great without any issues from shell (i'm Windows user) and under WLS too.

While for some reasons if I'm running build from sbt-shell from inside of Intellij Idea i'm getting classpath error with `java.net.http package not found`, I've tried to add custom vm option with `--add-modules java.net.http` and tried custom launcher, nothing helps.

From my point of view it seems intellij idea somehow are making jvm fork on build that doesn't have proper jvm arguments and I don't see any way to pass them into fork.

If anyone come across that or similar issue, any suggestions?

Thanks

0
3 comments

Could you share a log from the sbt shell startup and the error?

 

0
Avatar
Permanently deleted user

While I was preparing sample reproducible project which I could share with you, I've found issue that was causing buggy behavior:

I've noticed that I had two sections with add-modules definition in scalacOptions and javacOptions:

scalacOptions ++= Seq(
"-J--add-modules", "-Jjava.net.http"
),
javacOptions ++= Seq(
"--add-modules java.net.http"
)

It seems they was conflicting with each other, when I've removed javacOptions definition then idea plugin start working as expected.

Sorry for bothering and thanks you for your time that might spend into that "issue".

 

0

Glad to hear it works now and thanks for posting your solution!

 

0

Please sign in to leave a comment.