问题
I've created a gradle project with the following configuration:
group '...'
version '0.0'
apply plugin: 'java'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
test {
useTestNG()
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
}
When I execute "gradle build" I have the following error message:
Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.
This is weird since I have $JAVA_HOME set:
✗ echo $JAVA_HOME
/usr/lib/jvm/java-8-oracle
✗ $JAVA_HOME/bin/javac
Usage: javac <options> <source files>
where possible options include:
回答1:
I've found a solution.
To fix this issue I simply executed:
./gradlew build
This did the trick.
来源:https://stackoverflow.com/questions/32289233/gradle-cannot-find-jdk