我有一个带有多个模块的Java项目。在这个项目中,一个模块对另一个模块具有一个依赖性,仅针对特定配置文件需要,因此被定义为:
<profile>
<id>myProfile</id>
<dependencies>
<dependency>
<groupId>MyGroupId</groupId>
<!-- ... -->
</dependency>
</dependencies>
<!-- ... -->
</profile>
用像这样手动构建手动构建时可以正常工作:
mvn clean install -P myProfile
使用Intellij构建时,依赖项无法解决。
我已经尝试了委托IDE构建/运行操作的选项 ,在 build,eccution,explotion,exployment>" build build> build tools> maven> runner 即 -p -> myprofile (,更多,这很可能不是感兴趣的。
是否可以配置Intellij解决特定配置文件的依赖项?
帮助Intellij Idea了解您的Maven配置文件和Maven Object模式,您将MAVEN中的默认配置文件设置为默认配置文件,以便默认情况下它将由任何IDE识别并运行。我在代码片段下方提供。
<profile>
<id>firstProfile</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
..... Other code goes
</profile>
因此,在配置文件中,请使用此<activeByDefault>true</activeByDefault>
。它可能会解决问题。