[英]Gradle Project Dependencies not being found
Trying to build Java gwt Gradle multiproject in eclipse But cannot get a reference of project 2 into project 3 Any suggestion greatly appreciated.尝试在 Eclipse 中构建 Java gwt Gradle 多项目但无法将项目 2 引用到项目 3 任何建议,不胜感激。
Structure 3 projects结构3个项目
Project 1 TmsRoot (master project)项目 1 TmsRoot(主项目)
Project 2 CommonGWT (GWT Code)项目 2 CommonGWT(GWT 代码)
Project 3 Common (Non Gwt) Depends on CommonGWT项目 3 Common (Non Gwt) 依赖于 CommonGWT
settings.gradle file in TmsRoot project TmsRoot 项目中的 settings.gradle 文件
rootProject.name = "TmsRoot"
include ":ConmonGWT", ":Common"
TmsRoot build.gradle TmsRoot build.gradle
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
repositories {
mavenCentral()
}
dependencies {
}
version = '1.0'
jar {
manifest.attributes provider: ' Technologies'
}
}
CommonGWT build.gradle 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
}
And finally the Common build.graddle最后是 Common build.graddle
apply plugin: 'java'
apply plugin: 'eclipse'
dependencies {
compile project(':CommonGWT')
}
If I hit gradle refresh dependencies I get the following result FAILURE: Build failed with an exception.如果我点击 gradle refresh 依赖项,我会得到以下结果 FAILURE: Build failed with an exception。
Where: Build file 'C:\\Files\\Data\\Devel6\\Common\\build.gradle' line: 8其中:构建文件 'C:\\Files\\Data\\Devel6\\Common\\build.gradle' 行:8
What went wrong: A problem occurred evaluating root project 'Common'.出了什么问题:评估根项目“Common”时出现问题。 Project with path ':CommonGWT' could not be found in root project 'Common'.
在根项目“Common”中找不到路径为“:CommonGWT”的项目。
Try: Run with --stacktrace option to get the stack trace.尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output.
使用 --info 或 --debug 选项运行以获得更多日志输出。
BUILD FAILED构建失败
it seems to me, all your 3 project directories are on the same level.在我看来,您所有的 3 个项目目录都在同一级别。 I mean, root project directory doespn't contain within directories of subprojects, as:
我的意思是,根项目目录不包含在子项目的目录中,如:
.
├── TMsRoot
│ ├── build.gradle
│ └── settings.gradle
├── CommonGWT
│ └── build.gradle
└── Common
└── build.gradle
In that case, then settings.gradle file is not on the root directory of the subprojects, it must contain not include
, but includeFlat
, to specify subprojects.在这种情况下,则 settings.gradle 文件不在子项目的根目录中,它必须包含不是
include
,而是includeFlat
,以指定子项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.