1.下载nexus包,linux命令
wget http://sonatype-download.global.ssl.fastly.NET/nexus/oss/nexus-2.11.4-01-bundle.tar.gz
2.解压nexus包
tar -zxvf nexus-2.11.4-01-bundle.tar.gz
3.配置环境变量
export RUN_AS_USER=root
4.启动命令(start | stop | restart),前提是配置了Java环境,默认端口为8081
./nexus-2.11.4-01/bin/nexus start
5.可以修改自己默认端口(nexus-2.11.4-01/conf/nexus.properties)
6.登录界面:http://IP:8081/nexus
其中默认用户/密码:admin/admin123
登录后的界面
7.配置本地maven的setting配置
- <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">
- <!-- localRepository
- | The path to the local repository maven will use to store artifacts.
- |
- | Default: ${user.home}/.m2/repository
- -->
- <localRepository>D:/MvnRepository</localRepository>
- <servers>
- <server>
- <id>nexus-releases</id>
- <username>admin</username>
- <password>admin123</password>
- </server>
- <server>
- <id>nexus-snapshots</id>
- <username>admin</username>
- <password>admin123</password>
- </server>
- </servers>
- <mirrors>
- <mirror>
- <id>nexus</id>
- <name>internal nexus repository</name>
- <url>http://192.168.149.192:8081/nexus/content/groups/public/</url>
- <mirrorOf>central</mirrorOf>
- </mirror>
- </mirrors>
- <profiles>
- <profile>
- <id>nexus</id>
- <repositories>
- <repository>
- <id>nexus</id>
- <name>Nexus</name>
- <url>http://192.168.149.192:8081/nexus/content/groups/public/</url>
- <releases><enabled>true</enabled></releases>
- <snapshots><enabled>true</enabled></snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>nexus</id>
- <name>Nexus</name>
- <url>http://192.168.149.192:8081/nexus/content/groups/public/</url>
- <releases><enabled>true</enabled></releases>
- <snapshots><enabled>true</enabled></snapshots>
- </pluginRepository>
- </pluginRepositories>
- <distributionManagement>
- <repository>
- <id>nexus-releases</id>
- <name>Nexus Releases Repository</name>
- <url>http://192.168.149.192:8081/nexus/content/repositories/releases/</url>
- </repository>
- <snapshotRepository>
- <id>nexus-snapshots</id>
- <name>Nexus Snapshots Repository</name>
- <url>http://192.168.149.192:8081/nexus/content/repositories/snapshots/</url>
- </snapshotRepository>
- </distributionManagement>
- <activeProfiles>
- <!-- 激活nexusRepo这个profile:只有激活才生效 -->
- <activeProfile>nexus</activeProfile>
- </activeProfiles>
- </settings>
8.pom.xml文件配置
- <distributionManagement>
- <repository>
- <id>nexus-releases</id>
- <name>Nexus Release Repository</name>
- <url>http://192.168.149.192:8081/nexus/content/repositories/releases/</url>
- </repository>
- <snapshotRepository>
- <id>nexus-snapshots</id>
- <name>Nexus Snapshot Repository</name>
- <url>http://192.168.149.192:8081/nexus/content/repositories/snapshots/</url>
- </snapshotRepository>
- </distributionManagement>
基本配置已完成;
具体详情可参考博客:
http://blog.csdn.net/shenshen123jun/article/details/9084293
http://www.cnblogs.com/luotaoyeah/p/3791966.html