Gradle 未找到项目依赖项
Gradle Project Dependencies not being found
正在尝试在 eclipse 中构建 Java gwt Gradle 多项目
但是无法将项目 2 的引用引用到项目 3 中
非常感谢任何建议。
构建 3 个项目
项目 1 TmsRoot(主项目)
项目 2 CommonGWT(GWT 代码)
项目 3 Common(非 Gwt)依赖于 CommonGWT
settings.gradle TmsRoot 项目中的文件
rootProject.name = "TmsRoot"
include ":ConmonGWT", ":Common"
TmsRoot build.gradle
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
repositories {
mavenCentral()
}
dependencies {
}
version = '1.0'
jar {
manifest.attributes provider: ' Technologies'
}
}
CommonGWT build.gradle
apply plugin: 'war'
apply plugin: 'java'
apply plugin: 'gwt'
apply plugin: 'eclipse'
apply plugin: 'jetty'
dependencies {
compile 'org.slf4j:slf4j-api:1.7.12'
testCompile 'junit:junit:4.12'
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
version = '1.0'
buildscript {
repositories {
jcenter() //repository where to fetch gwt gradle plugin
}
dependencies {
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
}
}
repositories {
mavenCentral()
}
compileJava{
//enable incremental compilation
options.incremental = true
}
gwt {
gwtVersion='2.7.0'
modules 'com.stratebo.gwt.common'
sourceSets {
main {
java {
srcDir 'src'
}
}
}
logLevel = 'ERROR'
minHeapSize = "512M";
maxHeapSize = "1024M";
superDev {
noPrecompile=true
}
eclipse{
addGwtContainer=false // Default set to true
}
jettyRunWar.httpPort = 8089
}
task wrapper(type: Wrapper) {
gradleVersion = '2.8'
}
task jettyDraftWar(type: JettyRunWar) {
dependsOn draftWar
dependsOn.remove('war')
webApp=draftWar.archivePath
}
最后是 Common build.graddle
apply plugin: 'java'
apply plugin: 'eclipse'
dependencies {
compile project(':CommonGWT')
}
如果我点击 gradle 刷新依赖项
我得到以下结果
失败:构建失败,出现异常。
其中:
构建文件 'C:\Files\Data\Devel6\Common\build.gradle' 行:8
出了什么问题:
评估根项目 'Common' 时出现问题。
在根项目 'Common'.
中找不到路径为“:CommonGWT”的项目
尝试:
运行 使用 --stacktrace 选项获取堆栈跟踪。 运行 使用 --info 或 --debug 选项以获得更多日志输出。
构建失败
在我看来,您的3个项目目录都在同一级别上。我的意思是,根项目目录不包含在子项目目录中,如:
.
├── TMsRoot
│ ├── build.gradle
│ └── settings.gradle
├── CommonGWT
│ └── build.gradle
└── Common
└── build.gradle
在那种情况下,settings.gradle文件不在子项目的根目录下,它必须包含不是include
,而是includeFlat
,以指定子项目。
正在尝试在 eclipse 中构建 Java gwt Gradle 多项目 但是无法将项目 2 的引用引用到项目 3 中 非常感谢任何建议。
构建 3 个项目
项目 1 TmsRoot(主项目)
项目 2 CommonGWT(GWT 代码)
项目 3 Common(非 Gwt)依赖于 CommonGWT
settings.gradle TmsRoot 项目中的文件
rootProject.name = "TmsRoot"
include ":ConmonGWT", ":Common"
TmsRoot build.gradle
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
repositories {
mavenCentral()
}
dependencies {
}
version = '1.0'
jar {
manifest.attributes provider: ' Technologies'
}
}
CommonGWT build.gradle
apply plugin: 'war'
apply plugin: 'java'
apply plugin: 'gwt'
apply plugin: 'eclipse'
apply plugin: 'jetty'
dependencies {
compile 'org.slf4j:slf4j-api:1.7.12'
testCompile 'junit:junit:4.12'
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
version = '1.0'
buildscript {
repositories {
jcenter() //repository where to fetch gwt gradle plugin
}
dependencies {
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
}
}
repositories {
mavenCentral()
}
compileJava{
//enable incremental compilation
options.incremental = true
}
gwt {
gwtVersion='2.7.0'
modules 'com.stratebo.gwt.common'
sourceSets {
main {
java {
srcDir 'src'
}
}
}
logLevel = 'ERROR'
minHeapSize = "512M";
maxHeapSize = "1024M";
superDev {
noPrecompile=true
}
eclipse{
addGwtContainer=false // Default set to true
}
jettyRunWar.httpPort = 8089
}
task wrapper(type: Wrapper) {
gradleVersion = '2.8'
}
task jettyDraftWar(type: JettyRunWar) {
dependsOn draftWar
dependsOn.remove('war')
webApp=draftWar.archivePath
}
最后是 Common build.graddle
apply plugin: 'java'
apply plugin: 'eclipse'
dependencies {
compile project(':CommonGWT')
}
如果我点击 gradle 刷新依赖项 我得到以下结果 失败:构建失败,出现异常。
其中: 构建文件 'C:\Files\Data\Devel6\Common\build.gradle' 行:8
出了什么问题: 评估根项目 'Common' 时出现问题。 在根项目 'Common'.
中找不到路径为“:CommonGWT”的项目
尝试: 运行 使用 --stacktrace 选项获取堆栈跟踪。 运行 使用 --info 或 --debug 选项以获得更多日志输出。
构建失败
在我看来,您的3个项目目录都在同一级别上。我的意思是,根项目目录不包含在子项目目录中,如:
.
├── TMsRoot
│ ├── build.gradle
│ └── settings.gradle
├── CommonGWT
│ └── build.gradle
└── Common
└── build.gradle
在那种情况下,settings.gradle文件不在子项目的根目录下,它必须包含不是include
,而是includeFlat
,以指定子项目。