2014-12-07 55 views
1

我有以下构建脚本(Web应用程序:的build.gradle):为什么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

因为您尚未为此依赖项指定配置名称。它应该是如:

dependencies { 
    compile project(':api') 
} 

的webapp /的build.gradle

apply plugin: 'java' 

dependencies { 
    compile project(':api') 
} 

的webapp/settings.gradle

include 'api' 

的webapp/API /的build.gradle

apply plugin: 'java' 
相关问题