maven nexus私服搭建
1. 下载
wget http://download.sonatype.com/nexus/oss/nexus-2.12.0-01-bundle.tar.gz
2. 解压
tar zxvf nexus-2.12.0-01-bundle.tar.gz
解压后两个目录
nexus-2.12.0-01 //应用路径
sonatype-work //开发包存放路径
3. 配置
vim bin/nexus RUN_AS_USER=root vim conf/nexus.properties application-port=8888 //启动端口 nexus-work=/xxx/data/sonatype-work/nexus //jar包存放路径
4. 启动
./bin/nexus start
5. 查看UI
http://xxx.201.69.8:8888/nexus/
login default: admin/admin123
6. 配置nexus
将type为proxy的Repository的Download Remote Indexes 设置为true.
本地hosted仓库取不到即会向proxy远程仓库取。
7. IDE project配置
// pom.xml <distributionManagement> <repository> <id>releases</id> <name>xxx Releases</name> <url>http://xxx.201.69.8:8888/nexus/content/repositories/releases</url> </repository> <snapshotRepository> <id>snapshots</id> <name>xxx Snapshots</name> <url>http://xxx.201.69.8:8888/nexus/content/repositories/snapshots</url> </snapshotRepository> </distributionManagement> // setting.xml <server> <id>releases</id> <username>lqy_dev</username> <password>lqy123</password> </server> <server> <id>snapshots</id> <username>lqy_dev</username> <password>lqy123</password> </server>
发布不能成功可能原因,setting文件配置不正确,查看实际使用的setting文件:
mvn help:effective-settings