ubuntu安装nexus-3.0.2-02
下载地址https://www.sonatype.com/download-oss-sonatype
参考资料http://www.cnblogs.com/qq27271609/p/5497815.html
安装
解压安装包
tar -xvf nexus-3.0.2-02-unix.tar.gz
root账户启动nexus需要设置环境变量RUN_AS_USER=root
export RUN_AS_USER=root
启动nexus
./bin/nexus start
浏览器输入http://ip:8081
用admin/admin123登录,开启部署策略
settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>C:\Users\Kosh\.m2\repository</localRepository>
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<url>http://139.196.8.178:8081/repository/maven-public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
pom.xml
<distributionManagement>
<repository>
<id>nexus</id>
<name>Nexus Release</name>
<url>http://139.196.8.178:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<name>Nexus Snapshot</name>
<url>http://139.196.8.178:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
发布第三方包
输入如下命令:
mvn deploy:deploy-file -DgroupId=log4j -DartifactId=log4j -Dversion=1.2.17 -Dpackaging=jar -DrepositoryId=3rdparty -Dfile=E:\IDEA\log4j-1.2.17.jar -Durl=http://localhost:8081/repository/3rdparty/ -DgeneratePom=false
其中groupId artifactId version 根据实际情况填写 repositoryId跟settings.xml中的保持一致
url在repository的设置当中可以看到