Let’s say I want to create new project in IntelliJ IDEA. I click File->New->Project
, fill out all fields and get fresh project with structure like this:
.
└── my-project/
├── .git
├── .idea
├── .mvn
├── src
├── target
├── .gitignore
├── mvnw
└── pom.xml
I want to dockerize my application and create volume between my project and filesystem inside docker container. Since I:
- Want to be able to access
Dockerfile
from IDE file tree view - Don’t want
Dockerfile
to be in the volume
I decide to create directory app
and move all Java/Maven files needed to launch project inside.
.
└── my-project/
├── .git
├── .idea
├── .gitignore
├── app/
│ ├── .mvn
│ ├── src
│ ├── target
│ ├── mvnw
│ └── pom.xml
├── docker/
│ └── app/
│ └── Dockerfile
└── compose.yaml
Everything works fine until by some reason I need to reload Maven project (Right click on pom.xml -> Maven -> Reload project). Then IDE tree view starts to show only files located in my-project/app
directory, like this directory is a root of project
.
└── app/
├── .mvn
├── src
├── target
├── mvnw
└── pom.xml
Even if I’m trying to explicitly open my-project
directory as a project (File -> Open -> Select "my-project" directory
) IDE opens directory my-project/app
, not my-project
.
- Why IDEA opens
my-project/app
directory instead ofmy-project
? I assume IDEA treats directory wherepom.xml
located as root of project. Is it correct? - How I can move
pom.xml
into subdirectory without breaking IDE tree file view?