Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change JRE System Library for Maven project? [duplicate]

Tags:

java

maven

My project using Spring Framework 4.0.0 REALESE and maybe it not working on JDK version 1.5, so i want to change it to SE 1.8. I've tried to update my web project's JRE System library from SE 1.5 to 1.8. But i found out after updating project from Maven, my project automatically return to old version. How can i fix it?

like image 296
Thịnh Kều Avatar asked Jan 05 '23 18:01

Thịnh Kều


1 Answers

The following settings in our project pom.xml controls the JDK used for compilation

<properties>
    . . .
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    <maven.compiler.bootclasspath>C:\Program Files\Java\jdk1.8.0_101\jre\lib\rt.jar${path.separator}C:\Program Files\Java\jdk1.8.0_101\jre\lib\jsse.jar${path.separator}C:\Program Files\Java\jdk1.8.0_101\jre\lib\jce.jar</maven.compiler.bootclasspath>
    . . .
</properties>

Our project is a war artifact. After deployment, the configuration of the application server (in our case it is tomcat) determines the JVM that the app server and the app run under.

(Our environment is a bit special -- we use JVM/JDK 8 but use them with Java 1.7 compatibility mode. You don't have to follow this.)

like image 117
leeyuiwah Avatar answered Jan 31 '23 00:01

leeyuiwah