0

我在我的 repo 中发布了一个 jar,我们称之为 A.jar,它在 pom 中生成了以下依赖项:

<dependency>
  <groupId>org.json</groupId>
  <artifactId>json</artifactId>
  <version>20180130</version>
  <scope>compile</scope>
</dependency>

在另一个项目中,我们称之为 B,我在 build.gradle 中声明了以下依赖项:

compile 'my.test:A.jar' // With version etc, just to illustrate.

在此项目 B 使用的文件中,我收到以下编译错误:

错误:无法解析符号 JSONArray

这个 JSONArray 是 org.json.json 库的一部分。

我是否被迫从 Project B build.gradle 添加 org.json 的编译依赖项?这是默认行为吗?

--> compile group: 'org.json', name: 'json', version: '20180130'

从我的角度来看,当我已经为 A.jar 下载所需的依赖项时,它也会将它们作为依赖项添加到项目 B 中,这应该是有道理的

4

0 回答 0