繁体   English   中英

任务 ':compileJava' 执行失败。 摇篮

[英]Execution failed for task ':compileJava'. Gradle

我正在尝试在 eclipse 中设置我的第一个 gradle 项目,但是我在构建 gradle 时遇到了问题。 我已经从 spring.io 复制了 build.gradle,但它仍然无法正确构建。 我收到任务“:compileJava”的执行失败。 我的 build.gradle 文件看起来像这样

 buildscript {
repositories {
    mavenCentral()
}
dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.1.RELEASE")
}
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'

jar {
baseName = 'gs-spring-boot'
version =  '0.1.0'
}

repositories {
mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
// tag::jetty[]
compile("org.springframework.boot:spring-boot-starter-web") {
    exclude module: "spring-boot-starter-tomcat"
}
compile("org.springframework.boot:spring-boot-starter-jetty")
// end::jetty[]
// tag::actuator[]
compile("org.springframework.boot:spring-boot-starter-actuator")
// end::actuator[]
testCompile("junit:junit")
}

如上所述,您的构建无法编译

Compilation failed; see the compiler error output for details.

检查代码并找出导致它无法构建的原因。 尝试使用-s -i选项运行命令以找出问题所在。

将 javahome 变量更改为指向正确的目录,即您的 jdk 主目录。

在 Eclipse 中,您可以在 Java Home 下的运行配置中更改路径,例如更改为C:\\Program Files\\Java\\jdk-9.0.4 然后将配置作为cleanassemble

蚀

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM