Gradle中的文件依赖项?

u12*_*123 7 gradle

我试图使用gradle和这些指令指定一些jar依赖项:

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

我有以下项目:

test
 -> libs
     -> svnant.jar
 -> build.gradle
Run Code Online (Sandbox Code Playgroud)

其中build.gradle包含:

dependencies {
  runtime files('libs/svnant.jar')
  runtime fileTree(dir: 'libs', include: '*.jar')
}
Run Code Online (Sandbox Code Playgroud)

当我从windows cmd运行gradle时,我得到:

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'.
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

Pet*_*ser 10

runtime如果您应用java插件(或自行声明配置),您只能获得配置.

  • 如何在插件com.android.application中使用它?他们不能一起工作. (5认同)