【问题标题】:running gradle jettyRun error运行 gradle jettyRun 错误
【发布时间】:2015-05-16 10:21:27
【问题描述】:

我正在尝试使用 gradle jettyRun 运行我的 Spring Boot 应用程序,但是当 gradle 编译Java 时出现这些错误:

alberto@alberto-desktop:~/Credito/PalmasServer$ gradle jettyRun :编译Java FAILURE:构建失败并出现异常。 什么地方出了错: 无法解析配置 ':compile' 的所有依赖项。 找不到 org.springframework.data:spring-data-rest-webmvc:。 要求: :PalmasServer:未指定 找不到 org.hsqldb:hsqldb:。 要求: :PalmasServer:未指定 找不到 com.h2database:h2:。 要求: :PalmasServer:未指定 找不到 nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:。 要求: :PalmasServer:未指定 找不到 org.thymeleaf.extras:thymeleaf-extras-springsecurity3:。 要求: :PalmasServer:未指定 找不到 org.thymeleaf:thymeleaf-spring4:。 要求: :PalmasServer:未指定 尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。 构建失败

总时间:35.664 秒

这是我的 build.gradle 文件:

  buildscript {
    ext {
        springBootVersion = '1.1.9.RELEASE'
    }
    repositories {
        maven { url "http://repo.spring.io/libs-snapshot" }
        mavenLocal()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.9.RELEASE")
    }
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'war'
apply plugin: 'jetty'
apply plugin: 'application'
sourceCompatibility = 1.7
targetCompatibility = 1.7
war {
   version =  '0.1.0'
}
repositories {
    mavenCentral()
    maven { url "http://repo.spring.io/libs-snapshot" }
    maven { url "http://maven.springframework.org/milestone" }
    flatDir {
        dirs 'lib'
    }
}
dependencies {
    compile "xerces:xercesImpl:2.9.0"
    compile "net.sourceforge.nekohtml:nekohtml:1.9.12"
    compile "nekohtml:nekodtd:0.1.11"   
    compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}")
    compile("org.springframework.boot:spring-boot-starter-tomcat:${springBootVersion}")
    compile("org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}")
    compile("org.springframework.boot:spring-boot-starter-aop:${springBootVersion}")
    compile("org.springframework.boot:spring-boot-starter-test:${springBootVersion}")
    compile("org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}")
    compile("org.springframework.data:spring-data-rest-webmvc")
    compile("org.springframework.boot:spring-boot-starter-security:1.0.2.RELEASE")
    compile("org.springframework.security.oauth:spring-security-oauth2:2.0.0.RC2")
    compile("org.springframework.security.oauth:spring-security-oauth2-javaconfig:1.0.0.M1")
    compile("org.hsqldb:hsqldb")
    compile("com.h2database:h2")
    compile("com.google.guava:guava:17.0")
    compile("org.apache.commons:commons-lang3:3.3.2")
    compile("org.apache.httpcomponents:httpclient:4.3.4")
    compile("com.squareup.retrofit:retrofit:1.6.0")
    compile("commons-io:commons-io:2.4")
    compile("com.github.davidmarquis:fluent-interface-proxy:1.3.0")
    compile ("org.springframework.boot:spring-boot-starter-security:1.0.2.RELEASE")
   compile ("javax.servlet:jstl:1.2")
   compile ("commons-fileupload:commons-fileupload:1.3.1")
    testCompile("junit:junit")
    compile("nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect") 
    compile("org.thymeleaf.extras:thymeleaf-extras-springsecurity3")
     compile("org.thymeleaf:thymeleaf-spring4")
     def poiVersion = "3.10.1"
    compile "org.apache.poi:poi:${poiVersion}"
    compile "org.apache.poi:poi-ooxml:${poiVersion}"
   compile "org.apache.poi:ooxml-schemas:1.1"
}
jar {
    baseName = 'gs-uploading-files'
    version =  '0.1.0'
}
task wrapper(type: Wrapper) {
    gradleVersion = '1.11'
}

为什么当我在 Eclipse 中运行时一切正常????

还有什么想法吗?

【问题讨论】:

    标签: gradle dependencies spring-boot


    【解决方案1】:

    尝试添加以下代码:

    compile fileTree(dir: 'lib', include: ['*.jar'])
    

    dependencies 块。

    【讨论】:

    • 有效,但并非所有这些依赖项都在我的本地文件夹上。其余的必须下载。如果我在 Eclipse 中运行项目,一切正常。有什么想法吗?
    • 那么什么不起作用?您可以指定本地依赖项以及远程(grom maven 例如)。
    • 所以,现在 gradle 正在本地获取依赖项(并非所有依赖项都在我的本地文件夹中),其余的必须下载。现在找不到这些远程依赖项中的 6 个。但是,如果我在 Eclipse 中运行该项目,则一切正常。你知道为什么吗?我已经更新了新的错误。
    • 该项目可以在线访问吗?
    • 我想在本地复制它,因为我现在不明白。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-05-13
    • 2014-07-07
    • 2017-02-28
    • 1970-01-01
    • 2012-01-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多