简体   繁体   English

如何编译不同版本的Maven Web项目并在不同版本中运行

[英]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.

相关问题 如何使用不同的 Java 版本和 Maven 版本在 GitLab 上运行项目? - How to run project on GitLab with different Java version and Maven version? maven多模块项目,使用不同的java版本编译其中一个模块 - maven multi module project, compile one of the modules with a different java version 如何使用主要版本创建不同的Maven项目? - How to create a different Maven project with major relase version? 同一Maven项目的不同groupId(和版本) - Different groupId (and version) for a same Maven project Eclipse-编译并使用不同的Java版本运行 - Eclipse - compile and run with different Java version 如何在不同 java 版本的 Wildfly 服务器上运行两个 web 应用程序? - How to run two web application on wildfly server with different java version? Maven:当前项目和从属项目使用同一库的不同版本 - Maven: Current project and dependent project use different version of the same library 如何根据配置文件 maven 设置不同的版本 - How to set different version based on profile maven 如何在Maven中指定其他版本的Standard DocLet? - How to specify a different version of the Standard DocLet in Maven? Maven Project将构建由其他Java版本编译的其他jar - Maven Project to build additional jar compiled by different java version
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM