---------------------
環境
Conoha VPS
Ubuntu 16.04
---------------------
Could not find tools.jar その1
$ gradle jar
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Could not find tools.jar
eclipseではjarタスクが正常実行できるが、コマンド上からは異常終了するというケースでした。解決策は「その2」のところで。
Could not find tools.jar. その2
Could not find tools.jar. Please check that /usr/lib/jvm/java-8-openjdk-amd64 contains a valid JDK installation.
$ ls /usr/lib/jvm/java-8-openjdk-amd64/lib
の結果を見てください。そこにtools.jarはありますか?
Ubuntu16.04の初期状態では、java8の実行環境はありますが、開発環境(JDK)は入っていないようです。ですので、java8のJDKをインストールしましょう。
$ sudo apt install openjdk-8-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
openjdk-8-jdk-headless
…
Setting up openjdk-8-jdk:amd64 (8u151-b12-0ubuntu0.16.04.2) ...
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode
正常終了したら、再度libの中身を見てみます。
$ ls /usr/lib/jvm/java-8-openjdk-amd64/lib
amd64 ct.sym dt.jar ir.idl jconsole.jar jexec orb.idl sa-jdi.jar tools.jar
このように、tools.jarが存在するようになっていると思います。
Spring Boot plugin requires Gradle 4.0 or later
* What went wrong:
A problem occurred evaluating root project 'oldDomainManager'.
> Failed to apply plugin [id 'org.springframework.boot']
> Spring Boot plugin requires Gradle 4.0 or later. The current version is Gradle 2.10
Eclipseで作ったSpringBootプロジェクトを、Ubuntu16.04でgradle buildしたときのエラー。
$ gradle --version
------------------------------------------------------------
Gradle 2.10
------------------------------------------------------------
Build time: 2016-01-26 15:17:49 UTC
Build number: none
Revision: UNKNOWN
Groovy: 2.4.5
Ant: Apache Ant(TM) version 1.9.6 compiled on July 8 2015
JVM: 1.8.0_151 (Oracle Corporation 25.151-b12)
OS: Linux 4.4.0-98-generic amd64
このように、インストールしていたGradleが古かった。Gradleをアップデートして再実行することで正常終了した。