Running a project with dependencies in Docker

Answered

Hi,

I am trying to setup my Grails application with Docker-compose and be able to build my project with IntelliJ.

My project uses two docker services:

  • project image
  • MYSQL database image

I added a new Run configuration and connected to my Docker daemon. In the IntelliJ Docker view, they are not under "Containers", but instead, have their own directory. I think this is because they share a part of their name, just a different suffix. These are their names:

  • my_framework_project
  • my_framework_db

My project has dependencies, which are installed inside of my container, but not on my system directly. I set up a new Docker-compose configuration and added my services and docker-compose.yml file. When I try to build my project inside IntelliJ with my Docker-compose configuration, it instantly fails on being unable to resolve the dependencies only available in the docker container. The same happens when I try to run a single `my_framework_project` container without the docker-compose/db.

Running `docker-compose up` in the command line builds and runs my project without issues, but the IDE won't recognize the missing classes.

How can I connect my containers and build with IntelliJ? I can not install the dependencies on my system outside of Docker.

In my log, before all the unresolved classes, only these messages appear:

Information:Builder "Groovy compiler" requested rebuild of module chunk "my_framework"

Information:Build completed with 101 errors and 0 warnings in 6 s 787 ms

 

0
1 comment

IntelliJ IDEA doesn't support the true remote development when the SDK and dependencies are not available locally. To be able to build the project in IntelliJ IDEA and to see the errors/inspections in the code, IDE needs to index all the dependencies locally and have access to the SDK used to compile the project.

Please see https://youtrack.jetbrains.com/issue/IDEA-110822 and the linked issues for details.

0

Please sign in to leave a comment.