I use a build.gradle file which needs to reference some jar files which are neither available on a public nor an internal repository.
Because of that I put the jar files into a lib directory which is below my Eclipse project:
dependencies {
...
compile files('lib/*.jar')
}
This works fine as long as I run or export my program from within Eclipse. But when I try gradle build
gradle fails with this error:
Could not normalize path for file 'C:\Workspaces\MyProject\project\lib\*.jar'.
I changed the path to lib\*.jar
, added a leading ./
, removed the \*.jar
but to no avail.
When I remove the compile files
line from the dependencies and add this to repositories instead
repositories {
...
flatDir { dirs './lib' }
}
the compiler complains about error: cannot find symbol
, and all these symbols are in the jars referenced from the lib directory.
When I run gradle --debug
I can see from the log that the directory referenced by flatDir is being searched in:
10:02:20.587 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.ResourceVersionLister] using org.gradle.internal.resource.transport.file.FileResourceConnector@48499739 to list all in /C:/...../lib/
10:02:20.592 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.ResourceVersionLister] found 7 urls
7 is the count of files in the lib directory.
Why does this work in Eclipse (STS 3.7 with gradle tooling) and not from the command line ? I tried both gradle 2.2.1 and 2.5.