这两天使用eclipse建立maven项目,老是默认使用的老版本jdk,这让我很烦躁,网上有不少修改的帖子,今天忽然有兴致,决定在本身的博客记录一下;eclipse
在本身的maven安装目录总找到conf/settings.xml,在profile区添加以下配置:maven
<profile> <id>jdk-1.8</id> <activation> <activeByDefault>true</activeByDefault> <jdk>1.8</jdk> </activation> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> </properties> </profile> |
而后在eclipse-Preferences-Maven-User Settings,指定刚才编辑的settings.xml,spa
,xml
图中Global Settings和User Setttings设置哪个均可以,两者的区别是Global Settings一般配置的是你maven安装目录下cnof下的settings.xml文件,User Setttings是当前工做空间的,好比咱们当前项目依赖的maven本地仓库不在.m2/下,咱们能够经过复制maven安装目录conf/settings.xml到你想要指定的仓库位置,编辑文件添加ip
<localRepository>这里是你仓库目录的全路径</localRepository>ci |
,而后配置User Settings指向刚才所编辑的settings文件;get
粗浅理解,纯粹我的笔记,但愿能对他人有点帮助!博客
若有讲解错误,请留言指正,不胜感激!!!it