0

I have several JAR files, each with its own pom.xml file describing its dependencies. For example:

  1. one.jar depends on guava
  2. two.jar depends on one.jar and some other 3rd party
  3. three.jar depends on two.jar

I would like to create a project which depends on all those jars.

if it's a Maven project, then I simply install the JARs to my .m2 with their poms and Maven does all the rest for me.

The question is what is the correct way to create a Gradle project depended on those JARs?

(I'm a total rookie in Gradle, read some tutorials and been searching for ways to achieve this with no luck so far)

Thanks in advance.

AntonKam
  • 163
  • 11
  • 1
    go to build.gradle file and add all jars compile fileTree(dir: 'libs', include: '*.jar') to your dependencies in the build.gradle then all the jars in the libs folder will be included. – Pradeep Nov 03 '17 at 07:58
  • refer to this link https://stackoverflow.com/questions/21046095/how-can-i-add-a-jar-in-my-gradle-project – Pradeep Nov 03 '17 at 07:59
  • I dont think this question is a duplicate of the one you linked, because he asked about including a file dependency with a POM, so with transitive dependencies. – Lukas Körfer Nov 03 '17 at 09:51

1 Answers1

1

Gradle uses the Maven repository technology and provides support for the local Maven repository. Just add mavenLocal() to your repositories block and you can use the dependencies you installed via Maven in your build.

Lukas Körfer
  • 13,515
  • 7
  • 46
  • 62