2

I have problem with include local jar file.

I have two projects:

ProjectA

ProjectB

  --libs

   ----jgrapht-jdk1.6.jar

My build file include (This is the part that concerns projectB):

project(':ProjectB') {

apply plugin: 'java'
repositories {
    mavenCentral()
}
configurations {
    compileOnly
}
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
dependencies {
    compileOnly files('libs/jgrapht-jdk1.6.jar')
    compile 'org.simpleframework:simple-xml:2.7@jar'       
}}

I run command gradlew -q dependencies and see result


Project :ProjectB

archives - Configuration for archive artifacts.
No dependencies

compile - Compile classpath for source set 'main'.
\--- org.simpleframework:simple-xml:2.7

compileOnly
No dependencies

default - Configuration for default artifacts.
\--- org.simpleframework:simple-xml:2.7

runtime - Runtime classpath for source set 'main'.
\--- org.simpleframework:simple-xml:2.7

testCompile - Compile classpath for source set 'test'.
\--- org.simpleframework:simple-xml:2.7

testRuntime - Runtime classpath for source set 'test'.
\--- org.simpleframework:simple-xml:2.7

Line compile 'org.simpleframework:simple-xml:2.7@jar' - working fine,
 but line compileOnly files('libs/jgrapht-jdk1.6.jar') don't work.

I use gradle 1.8, Windows 7 x64 Tell me please where I made a mistake.

Marek Sebera
  • 39,650
  • 37
  • 158
  • 244
AndreyNik
  • 1,581
  • 2
  • 17
  • 24

1 Answers1

3

It's a known limitation that file dependencies aren't currently shown by gradle dependencies. They nevertheless work (if the paths are right).

Peter Niederwieser
  • 121,412
  • 21
  • 324
  • 259
  • 1
    Thanks for the reply, actually I have a problem. After you build the project when you run a program error occurs NoClassDefFoundError it is in the class of the library jgrapht-jdk1.6.jar. But apparently, the error in another. thank you. – AndreyNik Oct 07 '13 at 19:53