JHipster_banner.png

Jhipster 7 impose d'utiliser un JDK Java version 11 à 17, j'ai ça sur ma Debian & mon Ubuntu et pourtant Jhipster plante en incriminant ma version de JDK ...

Bon, d'abord le message d'insulte:

 ...
 INFO 
 INFO BUILD FAILURE
 INFO 
 INFO Total time:  3.397 s
 INFO Finished at: 2021-12-05T11:07:56+01:00
 INFO 
 ERROR Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0:enforce (enforce-versions) on project fsj: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> Help 1
 ERROR
 ERROR To see the full stack trace of the errors, re-run Maven with the -e switch.
 ERROR Re-run Maven using the -X switch to enable full debug logging.
 ERROR
 ERROR For more information about the errors and possible solutions, please read the following articles:
 ERROR Help 1 http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Évidemment, vérifions la version du JDK:

 $ java -version
 openjdk version "17" 2021-09-14
 OpenJDK Runtime Environment (build 17+35-Ubuntu-120.04)
 OpenJDK 64-Bit Server VM (build 17+35-Ubuntu-120.04, mixed mode, sharing)

Ben alors ? Signalons qu'avec le JDK 11, j'obtiens exactement le même résultat... Et le lien indiqué en fin du message d'erreur n'apporte aucune aide.

La solution: c'est mon JAVA_HOME que visiblement maven utilise qui pose problème. Il était resté sur le JDK 8 qui est également installé sur mes machines. Et pourtant mon default-java pointe bien vers le JDK 17 (ou précédemment vers le JDK 11).

Réglons ça:

 $ export JAVA_HOME=/usr/lib/jvm/default-java

ou usr/lib/jvm/java-1.17.0-openjdk-amd64 par exemple.

Et là:

 ./mvnw
 ...
 INFO 
 INFO BUILD SUCCESS
 INFO 
 INFO Total time:  01:29 min
 INFO Finished at: 2021-12-05T11:10:25+01:00
 INFO 

Voilà, c'était in fine maven qui allait chercher ses informations dans JAVA_HOME, ce qui est, somme toute, assez logique ...