2015-01-15 213 views
0

我有一個Java EE項目。我正在使用Gradle作爲構建工具。我的build.gradle文件看起來如下:gradle項目的構建失敗

apply plugin:'war' 
apply plugin:'eclipse' 

buildscript { 
    repositories { 
    mavenCentral() 
    jcenter() 
    } 
    dependencies { 
    classpath "com.eriwen:gradle-js-plugin:1.12.1" 
    } 
} 

apply plugin: "com.eriwen.gradle.js" 


minifyJs { 
    source = file("src/main/webapp/js/App.js") 
    dest = file("build/all-min.js") 
    closure { 
     warningLevel = 'QUIET' 
    } 
} 

war.doFirst { 
tasks.minifyJs.execute() 
} 

war.webInf { 
from "build/all-min.js" 
into "/js/" 
} 

dependencies{ 

    compile 'org.springframework:spring-context:4.1.4.RELEASE' 
    compile 'org.springframework:spring-core:4.1.4.RELEASE' 
    compile 'org.springframework:spring-web:4.1.4.RELEASE' 
    compile 'org.springframework:spring-webmvc:4.1.4.RELEASE' 
    compile 'org.springframework:spring-jdbc:4.1.4.RELEASE' 
    compile 'org.springframework:spring-tx:4.1.4.RELEASE' 
    compile 'org.google.code.gson:gson:2.3.1+' 
    compile 'log4j:log4j:1.2.17+' 
    compile 'org.slf4j:jcl-over-slf4j:1.5.8+' 
    compile 'org.slf4j:slf4j-api:1.5.8+' 
    compile 'org.slf4j:slf4j-log4j12:1.5.8+' 
    compile 'org.apache.commons:commons-dbcp2:2.0.1+' 
    compile 'org.mybatis:mybatis-spring:1.2.2+' 
    compile 'org.mybatis:mybatis:3.2.8+' 
    compile 'com.oracle:ojdbc14:10.2.0.4.0+' 
    compile 'commons-fileupload:commons-fileupload:1.2.1+' 
    compile 'commons-io:commons-io:2.4+' 
    compile 'junit:junit:4.11' 
    compile 'javax.servlet:servlet-api:2.5' 
} 

然而,當我嘗試了,我在我的build.gradle文件中所提到的所有依賴的gradle執行構建我收到以下錯誤

couldnot resolve all dependencies required for configuration。我想我已經正確地提到了存儲庫。我不知道爲什麼我的構建失敗。任何建議,將不勝感激。

+0

該錯誤將具有它無法解決的特定依賴關係的細節。 – 2015-01-15 16:29:16

回答

1

您需要將repositories {...}配置塊添加到您的構建腳本中。在buildscript {...}塊中聲明的那個僅用於解析構建腳本本身(在本例中爲JavaScript插件)的依賴關係,但不用於解決項目依賴關係。