1. 使用mvn archetype:generate命令
2. 选择archetype类型:(默认是org.apache.maven.archetypes:maven-archetype-quickstart)
3. 选择版本(6->1.1):(默认6)
4. 输入groupId :com.nmj.test
5. 输入artifactId :test
6. 输入version :(默认1.0-SNAPSHOT)
7. 输入package :(默认)
Final:
maven默认使用JDK是1.5。修改pom.xml,追加:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.7.0</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build>
Or
<properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties>
Links: