Project source folders change automatically with Maven
Answered
Every time I add a new Maven dependency and it is automatically downloaded and added to the project libraries, the project sources folder change and the "src" folder is marked as the one and only source project. I don't want that. I usually unmark this folder and mark the src/main/java and src/test/java folder as sources folder because I don't want my packages name to have main.java or test.java prepended.
It is quite annoying having to do this process all over again when including a new Maven dependency. How can I avoid it?
Please sign in to leave a comment.
With a Maven project imported from pom.xml src/main/java and src/test/java will be automatically marked as sources and test sources. If it's not the case, please share the sample project to reproduce the problem.
What would you need to know?
Share a sample with pom.xml that after importing marks wrong directories as sources.
Here it is:
Well I just tried again. I deleted a dependecy and automatically "src" was marked as the source not the "java" folders and it messed up with the packages again.
Your pom.xml overrides Maven source root defaults with this line:
Remove this line and refresh the project.
See https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
Hi @Serge Getting the same issue .. Just with GRADLE. Can you please help me on this ?
Submit a ticket to support with your build.gradle attached.
@Serge : submitted a ticket --- please see -- https://intellij-support.jetbrains.com/hc/en-us/requests/2044771