A Contet Root that isn't desired is added in the Maven module

已回答

I'm using IntelliJ IDEA Ultimate 2018.1.1.

From this version, when importing a Maven project, Resource Folders is automatically added as Content Root.
The checkstyle directory appeared right under the module as shown below.

I do not need this.
A lot of all the modules are the same.
It is very inconvenient that the hierarchy of modules got deeper.


I think probably due to the definition below written in parent's pom.xml.
This is a necessary trick to share CheckStyle's exclusion settings.

 <build>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
<resource>
<filtering>true</filtering>
<directory>${project.root.dir}/config/dev/checkstyle</directory>
<targetPath>${project.build.directory}</targetPath>
<includes>
<include>checkstyle-maven.properties</include>
</includes>
</resource>
</resources>
...

I am individually deleting it in Project Structure, but It's harsh to me.
Moreover, Maven Reimport adds Content Root again.

When you change the setting in Project Structure, the following error also occurs.

Content root "D:\project\...\dev\checkstyle" is defined for modules "xxxxx" and "yyyyy".
Two modules in a project cannot share the same content root.

How can I prevent IntelliJ from adding to the Content Root when importing a Maven module?

0

Hello,

Is it possible to provide sample project example for investigation?

 

0

请先登录再写评论。