Maven安装和配置
(1)下载安装文件apache-maven-3.03-bin.tar
(2)解压至安装目录,安装完毕
(3)修改.bash_profile,修改maven安装路径,修改构建GC配置参数
vim ~/.bash_profile *********************************************** export MAVEN_HOME=path/apache-maven-3.0.3 export PATH=$PATH:$JAVA_HOME:$MAVEN_HOME/bin export MAVEN_OPTS='-Xmn400m -Xms1024m -Xmx1024m -Xss1m -XX:PermSize=384m -XX:MaxPermSize=384m' *********************************************** source ~/.bash_profile
(4)添加settings.xml,放在用户目录下,不用默认的settings.xml是为了每个用户都有自己的配置
mkdir ~/.m2 vim ~/.m2/settings.xml *********************************************** <settings> <!-- 配置maven本地repository的位置,可选 --> <localRepository>/Users/xxx/.m2/repository</localRepository> <!-- 配置开发者打包jar并上传nexus的用户名和密码 --> <servers> <server> <id>nexus-releases</id> <username>admin</username> <password>xxxxx</password> </server> <server> <id>nexus-snapshots</id> <username>admin</username> <password>xxxxx</password> </server> </servers> <profiles> <!-- 配置maven私服的地址,maven在构建时会先从私服尝试下载,如找不到再从中央仓库下载 --> <profile> <id>nexus</id> <repositories> <repository> <id>nexus</id> <name>local private nexus</name> <url>http://123.45.56.78:8081/nexus/content/groups/public</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>local-plugin-repository</id> <name>local private plugin repository</name> <url>http://123.45.67.78:8081/nexus/content/groups/public</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles> </settings> ***********************************************
(5)验证:mvn -version 查看安装路径,确认是不是安装成功