1

I am trying to set up my first gradle project in eclipse but im having problem with building gradle. I' ve copied build.gradle from spring.io but still it wont build properly. I get Execution failed for task ':compileJava'. My build.gradle file looks like this

 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")
}
anon
  • 11
  • 1
  • 1
  • 5

2 Answers2

0

Your build cannot be compiled, as stated

Compilation failed; see the compiler error output for details.

check the code and find what causes it to not to build. Try to run the command with -s -i options to find out what is wrong.

Martin Linha
  • 979
  • 9
  • 21
0

Change the javahome variable to point to the proper directory, i.e. to your jdk home directory.

In Eclipse you can change the path in a run configuration under Java Home, for example to C:\Program Files\Java\jdk-9.0.4. Then run the configuration as clean and assemble.

Eclipse

PHPirate
  • 7,023
  • 7
  • 48
  • 84