[英]How to compile maven web project in different version and run in different version
I have created a maven web project in eclipse. 我已经在Eclipse中创建了一个Maven Web项目。 I want to compile it in jdk 1.6 and have its run time environment as 1.8.I have tomcat as the web container to run the project.
我想在jdk 1.6中编译它,并使其运行时环境为1.8。我将tomcat作为运行项目的Web容器。 For compiling I am aware of the Compliance level option in the project settings.
对于编译,我知道项目设置中的“符合性级别”选项。 Is it the correct way to go about the compile time requirement?
这是满足编译时间要求的正确方法吗? And what settings do I have to change to make it run on java 1.8?
我必须更改哪些设置才能使其在Java 1.8上运行?
Use the Maven compiler plugin to set the source and runtime version of jdk & jvm respectively. 使用Maven编译器插件分别设置jdk和jvm的源版本和运行时版本。
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.6</source>
<target>1.8</target>
</configuration>
</plugin>
<plugins>
<pluginManagement>
<build>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.