while building a jenkins plugin , i saw this error on ubuntu:
./gradlew jpi
:localizer UP-TO-DATE
:stapler UP-TO-DATE
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Could not find tools.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 7.036 secs
to fix this:
- Run
export JAVA_HOME=`jrunscript -e 'java.lang.System.out.println(java.lang.System.getProperty("java.home"));'`
- Run gradle again
./gradlew jpi