简体   繁体   English

gradle项目的构建失败

[英]gradle project's build fails

I have a java EE project. 我有一个Java EE项目。 I am using gradle as a build tool. 我正在使用gradle作为构建工具。 My build.gradle file looks as follows: 我的build.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'
}

However when I try to execute gradle build I get the following error 但是,当我尝试执行gradle build时,出现以下错误

couldnot resolve all dependencies required for configuration for all the dependencies that I have mentioned in my build.gradle file. couldnot resolve all dependencies required for configuration我在build.gradle文件中提到的couldnot resolve all dependencies required for configuration所需的所有依赖项。 I think I have correctly mentioned the repositories . 我认为我已经正确提到了存储库。 I cant figure out why my build is failing. 我不知道为什么我的构建失败了。 Any suggestion would be appreciated. 任何建议,将不胜感激。

You need to add a repositories {...} configuration block to your build script. 您需要在构建脚本中添加repositories {...}配置块。 The one declared inside the buildscript {...} block is only used for resolving dependencies of the build script itself (in this case, the javascript plugin), but it is not used for resolving project dependencies. buildscript {...}块中声明的一个仅用于解决构建脚本本身的依赖关系(在本例中为javascript插件),但不用于解决项目依赖关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android-具有2个源文件夹的项目的Gradle构建失败 - Android - gradle build for project with 2 source folders fails 下载最新的Gradle版本后无法建立专案 - Project fails to build after downloading latest gradle version Gradle build failed for Received status code 407 from server: Proxy Authentication Required, but another project's with similar deps Success - Gradle build fails for Received status code 407 from server: Proxy Authentication Required, but another project's with similar deps succeeds Gradle在IntelliJ Plugin项目中尝试使用PsiMethod生成类失败 - Gradle fails trying to build class using PsiMethod in IntelliJ Plugin project Gradle构建失败 - Gradle build fails 用Gradle构建Maven项目 - Build Maven project with Gradle Gradle CleanBuild期间Gradle compileTestJava失败 - Gradle compileTestJava fails during gradle clean build 使用Javadoc NullPointerException,Gradle Build失败 - Gradle Build fails with Javadoc NullPointerException Gradle多项目构建命令失败,但对子项目可正常使用 - Gradle multi-project build command fails but works correctly for sub-projects 由于'fatJar任务',Gradle构建失败,尽管代码在另一个项目中适用于我 - Gradle build fails thanks to 'fatJar task' although code worked for me in another project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM