1

How do I import a JAR file as a dependency through a full Windows URL? I'm trying to import JAR file on a network drive (labeled "H") and I cannot use Maven Central easily because of our silly firewall.

when I try to use compile files I still get compile errors due to the dependency classes not being found.

apply plugin: 'java'

dependencies {
    compile files ("H/Processes/Development/libraries/hikari-cp/HikariCP-2.4.1.jar")

}

sourceSets {
    main.java.srcDir "src/main/java"
    main.resources.srcDir "src/main/resources"
}


jar { 
    from configurations.compile.collect { entry -> zipTree(entry) }
}
tmn
  • 11,121
  • 15
  • 56
  • 112
  • 3
    You left out the colon after `H`. – MirMasej Sep 10 '15 at 18:03
  • use h: like MirMasej said, you might find more information here: http://stackoverflow.com/questions/31311386/problems-during-build-when-referencing-static-lib-directory-gradle – Marged Sep 10 '15 at 18:18

1 Answers1

3

It looks like there is an error in your path. It should be corrected like this.

H:/Processes/Development/libraries/hikari-cp/HikariCP-2.4.1.jar

If you want to add more than one jar file as dependencies, here is how to do it(relative path is used in here)

dependencies {
    compile fileTree(dir: '../../lib', include: '**/*.jar')
}
shan1024
  • 1,389
  • 7
  • 17