[Maven] Content root is added on every restart of IntelliJ

Answered

Hi everyone!

This must be a simple configuration issue, but I have a project where I added Maven to. Everything is working fine, however my project structure is doing some weird things. The content root configuration for my module was already set. Now that I have Maven, this is imported from the pom. IntelliJ though keeps on loading that and adding content root upon content root. I guess that shouldn't be the case right? :)

Thanks for any help,

Vincent

0
11 comments

Do you see same issue: IDEA-284553 Source root is duplicate?

Could you please attach screenshot showing the problem, the project configuration files (the .idea directory and module's .iml files) and IDE logs zipped (use Help | Collect Logs and Diagnostic Data action after Reload action in maven tool window).

For uploading you can use https://uploads.jetbrains.com or any file sharing service.

It should probably help to re-import project (deleting existing project configuration) as a Maven project anew.

1

It seems like the same issue indeed, removing the .idea folder didn't solve it unfortunately. I don't think I have .iml files, those are for the IDEA module system right? I'll attach some screenshots and the log, thanks for replying!

All files are here: 2022_02_07_SNqm4FM4szNnR4rJ

0

Thanks. Unfortunately see no suspicious issues in logs. Is it possible to get a sample project where this is reproduced?

Please make sure to check the latest version from https://www.jetbrains.com/idea/download/ 

Also try if is helps to disable the Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | Importing | Store generated project files externally option.

0

Latest version indeed, unfortunately that didn't do the trick either. I do get an .iml file now:

<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_17">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-base:win:17.0.2" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-controls:win:17.0.2" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:17.0.2" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:win:17.0.2" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-base:17.0.2" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-fxml:win:17.0.2" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-controls:17.0.2" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.jetbrains:annotations:22.0.0" level="project" />
</component>
</module>
0

Not seeing anything really wrong there, it doesn't hurt for me to remove the content roots, it's just annoying. :)

0

Could you please zip all the project's configuration files, representing the full project structure (complete `.idea` directory and .iml files in locations of their modules)?

0

I can, but it's solved! ;) I decided to rename the project, rename the directory in which it resides etc. Then removed the .idea, build and target directories and now it's not showing this behavior anymore. I also renamed the project accordingly in the pom.xml, I'm wondering if I had a naming conflict perhaps that would create new content roots? Still wouldn't make a lot of sense that it would do this over and over though.

0

Thanks for the information. Do you have project configuration at a state when the issue is reproducible?

0

Didn't save it in that state unfortunately. Do you still want them in the current state? I'm guessing there's not a lot to be found now.

0

Yes, provide the current project files state, please just in case. Thank you!

0

So, the complete .idea folder I already uploaded above, which was the weird state. The iml files I don't have it seems, the way I have the project.

0

Please sign in to leave a comment.