Problem with jdk version

maven
plugin
Tags: #<Tag:0x00007fb883dfb450> #<Tag:0x00007fb883dfb1a8>

#1

Hello.
I’m trying to build a project of a plugin using Maven but I get the following error:

“Rule 2: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
Detected JDK Version: 1.7.0-151 is not in the allowed range 1.8.0-101.”

(i’m using netbeans IDE)
How can I force the use of JDK 1.7 ?
Thanks!


#2

If your pom.xml inherits from pom-scijava, the project will target Java 1.8, as defined in pom-scijava-base:

I guess you can override this in your own pom.xml:

<scijava.jvm.version>1.7</scijava.jvm.version>

but I’m not sure about the consequences, as many of the projects in the SciJava universe target Java 1.8.


Why can’t you use a JDK 1.8.0 on your system?


#3

Thank you for the quick and detailed answer.
I’m working on ubuntu 14.01 and the openjdk system package doesn’t go beyond v.1.7
I wouldn’t like to install an ad-hoc jdk, but if this is the only way…


#4

I would advise keeping your JDK up to date. One of the reasons, this minimum version was introduced was the lack of required certificates for switching the imagej update sites (and maven repositories) to https instead of http:


This ubuntu forum posts lists options of how to install openjdk8 on Ubuntu 14.04:


Additionally, openjdk is available through conda:
https://anaconda.org/anaconda/openjdk
https://anaconda.org/conda-forge/openjdk

Is there a particular reason that you need to work with Ubuntu 14.04?


#5

Thanks for the answer!
Yes, I should definitely upgrade to ubuntu 16


#6

If you are really stuck with Ubuntu 14.04, you can use the Zulu distribution of OpenJDK 8 via Azul’s repo.