[Maven - Java Version] 如何设置Maven的Java版本或者使用不同的JDK版本编译
In pom.xml, defined this maven.compiler.source properties to tell Maven to use Java 8 to compile the project.
1. Maven Properties
Java 8
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
Java 7
<properties>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.7</maven.compiler.source>
</properties>
2. Compiler Plugin
Alternative, configure the plugin directly.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
References
- Maven – Setting the -source and -target of the Java Compiler
- How to compile Maven project with different JDK version?
------使用和maven启动使用的jdk不同的jdk编译-----
https://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-using-different-jdk.html
-----可以在settings.xml或者环境变量中配置JAVA_1_6_HOME这种类型的,然后在
build-->plugins--> <plugin>-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable>${JAVA_1_6_HOME}/bin/javac</executable>
<compilerVersion>1.3</compilerVersion>
</configuration>
</plugin>
[Maven - Java Version] 如何设置Maven的Java版本或者使用不同的JDK版本编译的更多相关文章
- [Android] "Failed to find Java version for 'C:\Windows\system32\java.exe"
Impossible to install SDK r17 on win 7 x64 "Failed to find Java version for 'C:\Windows\system3 ...
- 安装Android Studio报failed to find java version for 'C:\windows\system32\java.exe':[2] The system cannot find the specified file.错误的解决方案
方案很简单,找到SYSTEM32目录下的java.exe文件,重命名为java.exe.orj. 方案出处:http://stackoverflow.com/questions/10339679/an ...
- 修改maven项目jdk版本,并解决Dynamic Web Module 3.1 requires Java 1.7 or newer错误
使用maven的时候,默认会使用1.5版本的JDK,并且创建项目时也会是1.5版本. 但是我想用JDK1.7版本,所以我手动将maven项目JDK改为1.7版本. 手动修改JDK版本为1.7以后,项目 ...
- maven设置指定jdk版本
今天心血来潮准备折腾一下jeecg,去下载了一个maven版本的项目,既然下载了maven版的,当然就要配置好maven环境了. 因为之前简单学习过maven,当时使用的版本是3.3.9的,但是今天在 ...
- ubuntu系统中java -version所显示的版本与/etc/profile中配置的$JAVA_HOME的关系
问题产生 ubuntu 18.04环境下,执行 java -version 发现与/etc/profile中的$JAVA_HOME所设置的java版本不同. 推测原因 最近用apt install 安 ...
- Java进阶(十二)JDK版本错误之Unsupported major.minor version 51.0(jdk版本错误)
错误:Unsupported major.minor version 51.0(jdk版本错误) 如果在win7下开发项目是使用的jdk版本和项目运行服务器jdk版本不同就会出现上面的问题. 用jdk ...
- eclipse中,项目无法在tomcat中发布(project facet java version 1.7 is not supported)
在tomcat中发布项目时无法添加项目,错误信息:project facet java version 1.7 is not supported,如下图 这是由于你的tomcat的jdk版本低于你项目 ...
- How to change java version in Linux
How to change default Java version on Linux Posted on November 1, 2015 by Dan Nanni Leave a comment ...
- Target JRE version (1.7.0_79) does not match project JDK version (java version "1.8.0_171"), will use sources from JDK: 1.7
IDEA不会自动匹配系统的JDK环境.如果在IDEA里面没有配置JDK,那么运行程序时就会报错 之前碰到这个问题卡了一下 顺手记录一下 出现此错误说明IDE中配置的jdk版本和你使用的jdk版本不一致 ...
随机推荐
- 2#第一个Java程序
好,我们来写一个最简单的Java程序: public class HelloWorld{ public static void main(String[] argc){ System.out.prin ...
- 00JAVA语法基础_动手动脑
1.仔细阅读示例: EnumTest.java,运行它,分析运行结果? 枚举类型的使用是借助ENUM这样一个类,这个类是JAVA枚举类型的公共基本类.枚举目的就是要让某个变量的取值只能为若干固定值中的 ...
- es6 遍历总结
1.for in / for of for in --> index是key值 var array = [1,2,3,4,5]; for(let index in array) { consol ...
- 论文速读(Yongchao Xu——【2018】TextField_Learning A Deep Direction Field for Irregular Scene Text)
Yongchao Xu--[2018]TextField_Learning A Deep Direction Field for Irregular Scene Text Detection 论文 Y ...
- android 开发设计模式---Builder模式
我们通过一个例子来引出Builder模式.假设有一个Person类,我们通过该Person类来构建一大批人,这个Person类里有很多属性,最常见的比如name,age,weight,height等等 ...
- 【DOM练习】百度历史搜索栏
HTML: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <t ...
- 【编程基础】C语言常见宏定义
我们在使用C语言编写程序的时候,常常会使用到宏定义以及宏编译指令,有的可能比较常用,有的可能并不是很常用,是不是所有的C语言宏定义以及宏指令你都清楚呢? 指令 用途详细介绍 # 空指令,无任何效果 # ...
- (cvpr2019 ) Better Version of SRMD
SRMD的内容上篇,已经介绍,本文主要介绍SRMD的升级版,解决SRMD的诸多问题, 并进行模拟实验. 进行双三次差值(bicubic)===>对应matlab imresize() %% re ...
- java线程学习之Sleep方法
sleep方法是在线程中常用到的一个方法,它是一个静态方法. sleep(long millis) 在指定的毫秒数内让当前正在执行的线程休眠(暂停执行),此操作受到系统计时器和调度程序精度 ...
- js时间相关
let date = new Date(); date.getYear(); //获取当前年份(2位) date.getFullYear(); //获取完整的年份(4位) date.getMonth( ...