Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 19854

How to include local jar file in gradle

$
0
0

Hello everyone. I’m a beginner for gradle.
I got a problem trying to add local jar.
Basically I need to use a unmaintained project changedistiller.


However, it’s not available in mavenCentral. So I have to add the local jar by myself.
After installing changedistiller, I got the “changedistiller-0.0.1-SNAPSHOT-jar-with-dependencies.jar” which is I needed.

Begining with gradle, I’ve tried several methods.

  1. Using flat dir in build.gralde
    flatDir {
    dirs ‘/…/gradle-changedistiller/libs’
    }
    I put the jar in the libs directory. But it report error with
    “error: package ch.uzh.ifi.seal.changedistiller does not exist”
    I believe it’s due to gradle don’t find the correct package.
  2. I read this thread talking about similar problem. Basically I need to give meta-info.
    Following their steps. I need to create a maven local repositry.
    I only have the jar file. So I copy the pom.xml in the origin changedistiller project and put it in the libs with a new name.
    projectDir/libs:
    —changedistiller-0.0.1.jar
    —changedistiller-0.0.1.pom
    Now in build.gradle, I use
    maven {
    url “${rootProject.projectDir}/libs/”
    }
    Still it report the same error “import ch.uzh.ifi.seal.changedistiller.ChangeDistiller;”
    So I think the jar might be successfully imported. But the name might be wrong.

I try to use “/gradlew build --scan” to see what can I get.
Under the build depency, there is nothing except “com.gradle:gradle-enterprise-gradle-plugin:3.2”
I think it’s wrong but I don’t know how to correct.
Anyone could give me some suggestion?


Viewing all articles
Browse latest Browse all 19854

Trending Articles