英文:
Removing other modules of Maven Profile from Project Directory of IntelliJ
问题
我已经创建了一个多模块的Maven项目,我想要有两个配置文件,如下所示:
<profiles>
<profile>
<id>bootstrap-server</id>
<modules>
<module>./bootstrapserver</module>
</modules>
</profile>
<profile>
<id>file-search</id>
<modules>
<module>./filesearch</module>
<module>./webservice</module>
</modules>
</profile>
</profiles>
当我选择,例如,file-search
配置文件时,IntelliJ可以成功构建该配置文件(使用IntelliJ中的集成Maven面板),并且只构建了我指定的两个模块,这是所需的行为。对于其他配置文件也有效。
然而,当我选择一个配置文件时,其他配置文件中的模块目录仍然显示在项目结构窗口中,如下所示。
上面的图片显示了在我激活file-search
配置文件时,IntelliJ如何显示项目结构。
我能否配置IntelliJ以删除项目窗口中未在一个配置文件中使用的模块?例如,如果我选择file-search
模块,我希望从项目面板中删除bootstrapserver
模块,因为在file-search
配置文件下未被使用。
谢谢。
英文:
I have created a multi-module maven project and I want to have two profiles, which I've declared as below.
<profiles>
<profile>
<id>bootstrap-server</id>
<modules>
<module>./bootstrapserver</module>
</modules>
</profile>
<profile>
<id>file-search</id>
<modules>
<module>./filesearch</module>
<module>./webservice</module>
</modules>
</profile>
</profiles>
When I choose, for an example, file-search
profile, IntelliJ builds the profile fine (Using integrated maven panel in IntelliJ) and it builds only the two modules I've specified, which is the required behaviour. It works well for the other profile as well.
However, when I choose one profile, the directories of the modules in other profiles remain in the project structure window, as displayed below.
The image above shows how IntelliJ shows the project structure when I activate file-search
profile.
Can I configure IntelliJ to remove the modules displayed in the Project window which are not used in one profile? For an example, if I select file-search
module, I want to remove bootstrapserver
module from the Project panel since it's not being used when developing under file-search
profile.
Thank you.
专注分享java语言的经验与见解,让所有开发者获益!
评论