【问题标题】:Maven multiple module conflictMaven多模块冲突
【发布时间】:2012-03-02 10:17:40
【问题描述】:
<module>APP_1</module>
<module>web_1</module>
<module>service_1</module>
<module>schema_1</module>

<module>APP_2</module>
<module>web_2</module>
<module>service_2</module>
<<module>schema_2</module>

我有这样的项目结构,但在某些项目中,如果我想构建 service_1,我需要 service_2,而对于构建 service_2,我需要 service_1,反之亦然。

那么我应该如何解决这个与 maven 的冲突。

【问题讨论】:

    标签: maven maven-2 maven-plugin maven-3 maven-release-plugin


    【解决方案1】:

    您无法使用 Maven 或任何其他构建工具解决此冲突。这不是构建工具问题,而是架构缺陷,只能通过refactoring 解决。

    立即想到两个选项:

    1) 创建一个名为“service_common”的新模块,其中包含 service_1 和 service_2 都需要的东西。使 service_common 成为这两个模块的依赖项。

    2) 将 service_1 需要的东西从 service_2 移到 service_1。那么 service_1 不依赖任何东西,而 service_2 依赖于 service_1。

    有很多方法可以解决这个问题,但是无论语言或构建工具如何,循环的模块间依赖关系都是非常重要的。

    【讨论】:

    • 再次感谢您的回答!!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-15
    • 1970-01-01
    • 1970-01-01
    • 2011-08-21
    • 2021-08-26
    • 2011-07-17
    相关资源
    最近更新 更多