从IntelliJ的项目目录中删除Maven配置文件中的其他模块。

huangapple 未分类评论46阅读模式
英文:

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面板),并且只构建了我指定的两个模块,这是所需的行为。对于其他配置文件也有效。

然而,当我选择一个配置文件时,其他配置文件中的模块目录仍然显示在项目结构窗口中,如下所示。

从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.

&lt;profiles&gt;
  &lt;profile&gt;
     &lt;id&gt;bootstrap-server&lt;/id&gt;
     &lt;modules&gt;
      &lt;module&gt;./bootstrapserver&lt;/module&gt;
     &lt;/modules&gt;
  &lt;/profile&gt;
  &lt;profile&gt;
    &lt;id&gt;file-search&lt;/id&gt;
      &lt;modules&gt;
       &lt;module&gt;./filesearch&lt;/module&gt;
       &lt;module&gt;./webservice&lt;/module&gt;
      &lt;/modules&gt;
  &lt;/profile&gt;
&lt;/profiles&gt;

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.

从IntelliJ的项目目录中删除Maven配置文件中的其他模块。

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.

huangapple
  • 本文由 发表于 2020年4月4日 12:32:26
  • 转载请务必保留本文链接:https://java.coder-hub.com/61023780.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定