Can I build my sbt/scala stuff inside a container?

Answered

There's a great feature in PyCharm where I can specify a Python runtime that's inside of a docker image, or specified by a docker-compose file. When I run a script or build my project then it runs entirely inside my Docker image.

This is a great feature because it means that nothing on the host system can affect the way my project runs. It's all defined by a docker image, and I have Docker's cast-iron guarantee that my Python will run identically on my workstation as a server. 

If I use it with Docker Compose, I can define a bunch of services (e.g. message queue, MySQL) that work alongside my programs. It's much less work than having to set up all these components manually.

I was wondering if there's a similar feature for Scala or JDK projects:

It's easy to set up a docker image so that when I click the Run button, it runs inside a container. When I run tests on my project I want it to compile and execute inside the container too. Can this be done?

2
9 comments

There is no integration that will show you the tests tree, compilation errors and other  features like with local SBT/JDK. There is only Docker integration that allows to run any Dockerfile. With IntelliJ IDEA Docker integration you can set up the project to build and run in a container, just like you would do from the command line Docker.

IntelliJ IDEA has no support for remote JDK at the moment.

0

Hi, is there any update on this?

1

Please follow the related request on YouTrack: https://youtrack.jetbrains.com/issue/SCL-15466 

1

Thanks I do now and I've described my typical use case, but that issue has been open for over three years now without any response. I believe just following it is in vain. Do you happen to know whether there is any ETA on it or whether it is a sub-issue to some other issue being actively addressed? I think there was already a request for remote Docker development environments, compared to VS Code.

1

I asked developers to share plans for this issue on YouTrack.

1

Thanks, I appreciate it. Hope there's some effort under way. This feature is badly needed. With the IntelliJ platform running on a JVM, I suppose it shouldn't be too complicated.

1

@... your link seems to contain a URI-encoded Unicode nbsp character, which results in a 404 response. 
Here the link for the meantime for the curious: https://youtrack.jetbrains.com/issue/SCL-15466.

By the way, there still has been no reaction to this issue yet over there. Any estimate on the ETA?

1

Sorry for the delay. Updated on YouTrack.

1

@... Thanks for following up, much appreciated.

0

Please sign in to leave a comment.