<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- 配置Maven本地仓库的位置,从中央仓库下载的jar文件将保存在这个文件夹中,所有Maven项目都将优先从这个本地仓库中查找所需的jar文件 -->
<localRepository>E:/Maven/repository</localRepository>
<!--
<interactiveMode>true</interactiveMode>
-->
<!--
<offline>false</offline>
-->
<!--
<pluginGroups>
<pluginGroup>com.your.plugins</pluginGroup>
</pluginGroups>
-->
<!--
<proxies>
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>
-->
<!--
<servers>
<server>
<id>deploymentRepo</id>
<username>repouser</username>
<password>repopwd</password>
</server>
</servers>
-->
<!-- 配置Maven中央仓库的镜像,默认的中央仓库访问受限,jar文件下载速度慢,我们优先推荐从国内的镜像中央仓库下载jar文件 -->
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<!-- 对Maven项目使用的JDK版本进行配置,Maven项目默认使用的JDK版本是JDK 1.5,经过这个配置,我们可以默认让所有新建的Maven项目以JDK 1.8的版本创建 -->
<profiles>
<profile>
<id>jdk-1.8</id>
<activation>
<jdk>1.8</jdk>
<activeByDefault>true</activeByDefault>
</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>
</profiles>
<!--
<activeProfiles>
<activeProfile>alwaysActiveProfile</activeProfile>
<activeProfile>anotherAlwaysActiveProfile</activeProfile>
</activeProfiles>
-->
</settings>
public class HelloMaven {
private String msg = "Hello Maven";
public void sayHi() {
System.out.println(msg);
}
}
public class TestHelloMaven {
@Test
public void testHelloMaven() {
HelloMaven hm = new HelloMaven();
hm.sayHi();
}
}
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<!--修改使用的junit版本为4.12版本,原来是3.8.1版本-->
<version>4.12</version>
<scope>test</scope>
</dependency>
原文:https://www.cnblogs.com/noyitela/p/10386397.html