为什么没有gradle返回其他项目的依赖项?

时间:2014-12-07 08:55:08

标签: java groovy gradle

我有以下构建脚本(webapp:build.gradle):

apply plugin: 'java'

dependencies {
    project(':api')
}

当我在命令行中运行gradle dependencies webapp:dependencies时,我得到:

:dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

No configurations
:webapp:dependencies

------------------------------------------------------------
Project :webapp
------------------------------------------------------------

archives - Configuration for archive artifacts.
No dependencies

compile - Compile classpath for source set 'main'.
No dependencies

default - Configuration for default artifacts.
No dependencies

runtime - Runtime classpath for source set 'main'.
No dependencies

testCompile - Compile classpath for source set 'test'.
No dependencies

testRuntime - Runtime classpath for source set 'test'.
No dependencies

关于api项目的依赖性没有任何说法。为什么?怎么了?

1 个答案:

答案 0 :(得分:1)

因为您还没有为此依赖项指定配置名称。它应该是例如:

dependencies {
   compile project(':api')
}

<强> web应用程序/的build.gradle

apply plugin: 'java'

dependencies {
    compile project(':api')
}

<强> web应用程序/ settings.gradle

include 'api'

<强> web应用程序/ API /的build.gradle

apply plugin: 'java'