![](/img/trans.png)
[英]Gluon Project - Springboot Dependencies not found when i run /.gradle run
[英]Gradle Project Dependencies not being found
尝试在 Eclipse 中构建 Java gwt Gradle 多项目但无法将项目 2 引用到项目 3 任何建议,不胜感激。
结构3个项目
项目 1 TmsRoot(主项目)
项目 2 CommonGWT(GWT 代码)
项目 3 Common (Non Gwt) 依赖于 CommonGWT
TmsRoot 项目中的 settings.gradle 文件
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 refresh 依赖项,我会得到以下结果 FAILURE: Build failed with an exception。
其中:构建文件 '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
,以指定子项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.