【问题标题】:Make IntelliJ IDEA use a different pom file for maven project让 IntelliJ IDEA 为 maven 项目使用不同的 pom 文件
【发布时间】:2014-05-28 04:22:36
【问题描述】:

我在 IntelliJ IDEA 中导入了一个 Maven 项目。出于技术原因,我们有两个 pom 文件 - pom.xmlpom-local.xml

我可以使用 mvn -f pom-local.xml install 手动使用替代 pom 文件。 IDEA 使用pom.xml,但我找不到将其更改为pom-local.xml 的任何选项。有什么想法可以让 IDEA 使用替代的 pom 文件吗?

【问题讨论】:

  • 我们已经尝试过了,但效果不佳。依赖冲突存在一些问题。虽然使用不同的 pom 文件可能是一个临时解决方案,但这是我目前所坚持的。
  • 如果你的 pom 中有冲突,那么你可以使用依赖排除 maven.apache.org/guides/introduction/… 并从项目中为每个配置文件排除你想要的库。
  • 出于好奇——这种双文件方法解决了什么问题?

标签: maven intellij-idea pom.xml


【解决方案1】:

这取决于你如何定义

让 IDEA 使用替代的 pom 文件

假设您想使用备用 pom 文件运行和调试您的项目。 IntelliJ 让您可以像在终端上一样提供各种参数。只需通过 Shift + Alt + F9 调出调试配置。按左上角的小“+”号并选择“Maven”。在“命令行”输入中,只需提供 -f pom-local.xml test 或您想要执行的任何目标。

【讨论】:

    猜你喜欢
    • 2017-07-21
    • 1970-01-01
    • 2016-02-07
    • 1970-01-01
    • 2011-05-21
    • 1970-01-01
    • 2014-09-28
    • 2013-03-02
    • 1970-01-01
    相关资源
    最近更新 更多