Linux 安装配置maven3.0 以及搭建nexus私服
一、软件准备
1、apache-maven-3.0-bin.tar.gz 下载地址:http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0-bin.tar.gz
2、nexus-oss-webapp-1.8.0-bundle.tar.gz 下载地址:http://nexus.sonatype.org/downloads/
二、maven安装配置
1、创建需要操作maven的用户组以及用户(如果用root用户安装不用创建)
#groupadd configer //创建用户组#useradd -g configer configer //创建用户并指定用户组#passwd configer //为用户分配密码
#cd /opt#mkdir maven#chown -R configer:configer /opt/maven#chmod 755 /opt/maven#su -l configer#tar -zvxf apache-maven-3.0-bin.tar.gz
#vi /home/configer/.bash_profile
M2_HOME=/opt/maven/apache-maven-3.0export M2_HOMEPATH=$PATH:$M2_HOME/binexport PATH
#cd /opt/maven/apache-maven-3.0/bin#mvn --version
#cd /home/configer/.m2如果没有.m2目录,则可以手动添加一个#mkdir .m2
#vi /opt/maven/apache-maven-3.0/conf/settings.xml将文件中<localRepository>....</localRepository>的注释打开或者在文件中增加 在这个注释下增加<localRepository>your repository path</localRepository>
#tar -zvxf nexus-oss-webapp-1.8.0-bundle.tar.gz
#cd /opt/maven/nexus-oss-webapp-1.8.0/bin/jsw选择自己机器的版本:#cd linux-x86-32/#./nexus start重启:#./nexus restart停止:#./nexus stop
Apache SnapshotsCodehaus SnapshotsMaven Central
JBOSS的两个:http://repository.jboss.org/maven2/http://repository.jboss.org/nexus/content/repositories/releases/SUN的:http://download.java.net/maven/2/K-INT的:http://developer.k-int.com/maven2/因为找juel:juel-impl:2.2.1 这个jar包,所以我还添加了一个自己找的:http://repository.exoplatform.org/content/groups/public/
点击Add->Proxy Repository->填写Repository ID, Repository Name, 以及Remote Storage Location 其他的默认即可。
在repository列表中有一个3rd party,也就是第三方jar包,点击会看到一个Artifact Upload选项卡,点击后,填写相应的信息。GAV Definition 一般选择 GAV Parameters然后添加Group:Artifact:Version:Package示例 juel:juel-impl:2.2.1:jar
<settings> <proxies> <proxy> <id>normal</id> <active>true</active> <protocol>http</protocol> <username>deployment</username> <password>deploy</password> <host>localhost:8081/nexus</host> <port>80</port> <nonProxyHosts>localhost:8081/nexus</nonProxyHosts> </proxy> </proxies> <mirrors> <mirror> <!--This is used to direct the public snapshots repo in the profile below over to a different nexus group --> <id>nexus-public-snapshots</id> <mirrorOf>public-snapshots</mirrorOf> <url>http://localhost:8081/nexus/content/groups/public-snapshots</url> </mirror> <mirror> <!--This sends everything else to /public --> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://localhost:8081/nexus/content/groups/public</url> </mirror> </mirrors> <profiles> <profile> <id>development</id> <repositories> <repository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </pluginRepository> </pluginRepositories> </profile> <profile> <!--this profile will allow snapshots to be searched when activated--> <id>public-snapshots</id> <repositories> <repository> <id>public-snapshots</id> <url>http://public-snapshots</url> <releases><enabled>false</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>public-snapshots</id> <url>http://public-snapshots</url> <releases><enabled>false</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>development</activeProfile> </activeProfiles></settings>
#mvn archetype:generate
#mvn install 或者#mvn package