0

I published a jar in my repo, lets call it A.jar, which generated following dependency in pom:

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

In another project, lets call it B, I have declared following dependency in the build.gradle:

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

In the files used by this project B, I get following compile error:

error: cannot resolve symbol JSONArray

This JSONArray is part of the org.json.json library.

Am I forced from Project B build.gradle to add also the compile dependency for org.json? is this the default behaviour?

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

From my point of view, it should make sense that when I am already downloading required dependencies for A.jar, it also adds them as dependencies to Project B

Mayday
  • 4,680
  • 5
  • 24
  • 58
  • I think you must download the jar on your path. Check that: https://stackoverflow.com/questions/13155200/org-json-simple-cannot-be-resolved – Dev web May 25 '18 at 08:16
  • 1
    Please post your full `build.gradle` file or at least the parts responsible for dependencies, in detail the `repositories` and the `dependencies` block. – Lukas Körfer May 25 '18 at 08:22
  • I faced a similar problem, and I suspect that the problem is that version number is not of the form of a classic x.y.z. – Snicolas Feb 05 '19 at 01:04
  • Yes it might be related to : https://github.com/gradle/gradle/issues/1487 – Snicolas Feb 05 '19 at 01:07

0 Answers0