1、maven配置默认使用的JDK版本
原文地址:http://blog.youkuaiyun.com/robinjwong/article/details/44853811
在maven的默认配置中,对于jdk的配置是1.4版本,那么创建/导入maven工程过程中,工程中未指定jdk版本。
对工程进行maven的update,就会出现工程依赖的JRE System Library会自动变成JavaSE-1.4。
解决方案1:修改maven的默认jdk配置
maven的conf\setting.xml文件中找到jdk配置的地方,修改如下:
<profile>
<id>jdk1.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>
解决方案2:修改项目中pom.xml文件,这样避免在导入项目时的jdk版本指定
打开项目中pom.xml文件,修改如下:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
2、配置maven阿里云镜像
原文地址:http://blog.youkuaiyun.com/tengxing007/article/details/72588242
maven仓库默认在国外,使用难免很慢,尤其是下载依赖的时候,换为国内镜像,让你感受飞一般的感觉。国内支持maven镜像的有阿里云,开源中国等,这里换为阿里云的。
修改maven配置文件settings.xml (当然也可以在用户home目录.m2下面添加一个settings.xml文件)
将settings.xml中的mirror用下面的替换,保存即可
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>