我有以下构建脚本(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
项目的依赖性没有任何说法。为什么?怎么了?
答案 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'