Gradle – File dependencies in Gradle

gradle

I am trying to specify some jar dependencies using gradle and these instructions:

http://gradle.org/docs/current/userguide/dependency_management.html#sub:file_dependencies

I have the following project:

test
 -> libs
     -> svnant.jar
 -> build.gradle

where build.gradle contains:

dependencies {
  runtime files('libs/svnant.jar')
  runtime fileTree(dir: 'libs', include: '*.jar')
}

when I run gradle from windows cmd I get:

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\...\test\build.gradle' line: 16

* What went wrong:
A problem occurred evaluating root project 'test'.
> Could not find method runtime() for arguments [file collection] on root project 'test'.

what have I missed?

Best Answer

You only get a runtime configuration if you apply the java plugin (or declare the configuration on your own).