iml file not created in project root
Answered
Hey everyone,
I have just installed IntelliJ IDEA 2021.3.2 (Ultimate Edition) and noticed some strange behaviour with regards the location of where the .iml file is being created.
When opening a mvn project (pom.xml) for the first time the .iml file is being created in the directory above the project root. I was expecting the .iml file to be created at project root i.e. alongside the pom.xml.
What it looks like:
repofolder
│ testproject.iml
│ └───testproject
│ │ pom.xml
│ │ ...
What I expected:
repofolder
│ └───testproject
│ │ pom.xml
│ │ testproject.iml
│ │ ...
When creating a new maven project through the IDE the .iml is created where I would expect. It is created in the project root alongside the pom.xml
Please sign in to leave a comment.
Can't reproduce, please zip and share a sample project with the exact steps to recreate this problem: https://uploads.jetbrains.com.
Upload id: 2022_02_17_TyRKEQMYWkqDMvEG (files: test.zip and 2 more)
Steps to recreate:
- Create the following folder structure ~/tesfolder1/testfolder2/
- Unzip test project into testfolder2
- Open Intellij
- From Intellij splash screen select "Open"
- Navigate to and open ~/tesfolder1/testfolder2/test/pom.xml
- Select Open as Project
- Trust project
- Select Open Module Settings and navigate around
- Select OK to dismiss Module Settings window
- Look for test.iml file
- Expected behaviour is that it is in root of test project next to pom.xml
- Actual behaviour is that is is in ~/tesfolder1/testfolder2/ alongside the test project folder (see screen shots attached)
EDIT - I am running the IntelliJ IDEA Apple Silicon
Thanks
You can enable Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | Importing | Store generated project files externally option as a workaround. It's the default setting, by the way.
Bug reported: https://youtrack.jetbrains.com/issue/IDEA-289015
Thanks.
Hi Serge Baranov, thanks for your quick response.
I am slightly confused by the workaround? How will this store the .iml file in root of my project? I already had this set by the way.
In the bug you have raised I notice you have added the following line to the steps to recreate:
I did not have to do this.
With Store generated project files externally there should be no .iml files created in the project roots, they will be stored under System directory: https://www.jetbrains.com/help/idea/directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html#system-directory instead.
Try to enable this option, delete iml file and reimport the project.
I understand now thanks.
To be clear this option is already enabled for me (as you say its the default) and the .iml is stored alongside the project directory
When I disable this setting I get the same behaviour the .iml is created alongside the project directory (not in it).
It's another bug then, it should not be created outside of idea.system.path at all.
I downgrade my version to IntelliJ IDEA 2021.2.4 (Ultimate Edition) and the issue is not present.
Thanks
Hello. IDEA 2022.2.1 has the same bug. It's critical for run tests from IDE.
IntelliJ IDEA 2022.2.1 (Ultimate Edition)
Build #IU-222.3739.54, built on August 16, 2022
Runtime version: 17.0.3+7-b469.37 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.5.1
Yolkin Alex Please follow https://youtrack.jetbrains.com/issue/IDEA-289015 for updates.