$ export M2_HOME=/opt/apache-maven-3.5.0 $ export PATH=$M2_HOME/bin:$PATH $ mvn --version
$ mvn archetype:generate $ mvn compile $ mvn package
配置maven使用阿里源能夠提升編譯速度,添加文件~/.m2/setting.xml
。 此外,爲了使用lambda等特性,修改默認編譯器爲jdk1.8。apache
<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"> <mirrors> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors> <profiles> <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> </profiles> </settings>
也能夠使用阿里雲maven加速sbt的編譯,添加./sbt/repositories
內容以下maven
[repositories] local aliyun: http://maven.aliyun.com/nexus/content/groups/public/