我正在尝试使用gradle jettyRun运行我的Spring Boot应用程序但是当gradle正在编译Java时出现这些错误:
alberto @ alberto-desktop:〜/ Credito / PalmasServer $ gradle jettyRun :compileJava 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中运行时一切正常????
还有其他想法吗?
答案 0 :(得分:1)
尝试添加以下代码:
compile fileTree(dir: 'lib', include: ['*.jar'])
到dependencies
阻止。