gradle项目的构建失败

问题描述:

我有一个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

您需要将repositories {...}配置块添加到您的构建脚本中。在buildscript {...}块中声明的那个仅用于解析构建脚本本身(在本例中为JavaScript插件)的依赖关系,但不用于解决项目依赖关系。