【问题标题】:Cannot use interface or class from another local dependency module无法使用来自另一个本地依赖模块的接口或类
【发布时间】:2020-01-11 23:33:23
【问题描述】:
Parent Project 
|
|---pom.xml
|
|---Module A
|          |---pom.xml
|
|---Module B
           |---pom.xml

  • A 和 B 被声明为父模块。
  • Parent 被声明为 A 和 B 的

  • A依赖B,在A的pom.xml中:

<dependency>
     <groupId>abc.b</groupId>
     <artifactId>b</artifactId>
     <version>0.1</version>
</dependency>

我在 A 中使用 B 的接口,但是 A 找不到该接口: [错误] : 找不到符号/包。

我是不是因为依赖而错过了什么?

https://github.com/jianfeipan/ParisTraining/tree/master/server

父级:服务器

A:restapi

B:类服务

【问题讨论】:

  • Parent 和模块 A 的 groupIds 是什么?
  • 你已经构建模块 B 了吗?该接口是否新添加到模块 B 中?如果是这样,则意味着模块 B 仍在开发中,因此问题可能是您没有使用快照版本,因此 Maven 不知道查找该依赖项的更新。
  • 如果所有这些都包含在同一个 IntelliJ IDEA 项目中,则可能不需要为模块 A 构建模块 B 来解决依赖关系。但可能应该刷新 maven 面板。
  • 还要确保父模块列出所有子模块。
  • @UdithGunaratna groupId 对于 A 就像:abc.a 和 abc.b 对于 b。 abc.parent 为父级

标签: java maven intellij-idea dependencies


【解决方案1】:

我应该添加包...我的类直接在 java/ 下。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-04-05
    • 2021-01-05
    • 2017-10-19
    • 1970-01-01
    • 1970-01-01
    • 2019-07-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多