4

I have in gradle.build:

dependencies {
    classpath 'something:1.0'
}

What I need to add in the file to add a local .jar file, which java can "import"? But I don't need to include this .jar in my application. Just like a shared library.

I tried:

classpath 'something:1.0','somethingelse:1.0'
classpath 'something:1.0, somethingelse:1.0'
classpath { 'something:1.0','somethingelse:1.0' }
compile files('somethingelse.jar')
classpath files('lib/somethingelse.jar')
classpath fileTree(dir: 'lib', include: '*.jar')
Cœur
  • 37,241
  • 25
  • 195
  • 267
user64675
  • 482
  • 7
  • 25
  • Have you tried `providedCompile files('somethingelse.jar')`? This will make your `somethingelse.jar` available at the classpath during compile, but doesn't package it into the final artifact – Stanislav Jan 21 '16 at 16:45
  • FAILURE: Build failed with an exception. * What went wrong: A problem occurred evaluating root project 'blah-blah'. > Could not find method providedCompile() for arguments [file collection] on org .gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorat – user64675 Jan 21 '16 at 16:48
  • Have you applied the `war` plugin? Or what kind of application is it? If not WEB-APP, how is this lib provided? – Stanislav Jan 21 '16 at 16:51
  • It's a java application. No, no 'war' plugin – user64675 Jan 21 '16 at 16:55
  • It's not web. And it's not important how other libs provided – user64675 Jan 21 '16 at 17:03

1 Answers1

0

I think you want compile name: This recipie is in a gradle file I inherited.

repositories {
    flatDir {
        dirs 'lib'
    }


dependencies {
    compile name: 'jdom'
    compile name: 'jebl-0.3'
}

BTW, this question appears to be a duplicate of

How to add local .jar file dependency to build.gradle file?

Community
  • 1
  • 1
Chris Warth
  • 890
  • 12
  • 26