簡體   English   中英

找不到 Gradle 項目依賴項

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM