You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Maven项目依赖starter后无法使用其子模块,该如何调整?

解决方案

问题出在你的dynamic-thread-pool-starter模块只是通过<modules>节点聚合管理子模块构建,但未在自身pom.xml中声明对子模块的依赖,导致依赖传递失效。要实现仅依赖starter就能使用所有子模块内容,需修改dynamic-thread-pool-starter的pom.xml,显式添加所有子模块的依赖配置。

具体修改步骤

  1. 打开dynamic-thread-pool-starter模块的pom.xml文件
  2. 在<dependencies>节点内,逐个添加所有子模块的依赖,示例如下:
<dependencies>
    <!-- 引入thread-pool-domain模块依赖 -->
    <dependency>
        <groupId>cn.dcy.threadpool</groupId>
        <artifactId>thread-pool-domain</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <!-- 引入thread-pool-infrastructure模块依赖 -->
    <dependency>
        <groupId>cn.dcy.threadpool</groupId>
        <artifactId>thread-pool-infrastructure</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <!-- 引入thread-pool-types模块依赖 -->
    <dependency>
        <groupId>cn.dcy.threadpool</groupId>
        <artifactId>thread-pool-types</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <!-- 引入thread-pool-app模块依赖 -->
    <dependency>
        <groupId>cn.dcy.threadpool</groupId>
        <artifactId>thread-pool-app</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <!-- 引入thread-pool-trigger模块依赖 -->
    <dependency>
        <groupId>cn.dcy.threadpool</groupId>
        <artifactId>thread-pool-trigger</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
</dependencies>
  1. 保存pom.xml后,在dynamic-thread-pool-test模块执行mvn clean install命令,或在IDE中刷新Maven依赖

完成上述操作后,dynamic-thread-pool-test模块通过依赖dynamic-thread-pool-starter,就能自动获取所有子模块的内容,无需逐个添加子模块依赖。

内容的提问来源于stack exchange,提问作者Kyle

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 09:09:57