maven nexus-2.10.0-02 私服搭建
官方下载地址 :https://www.sonatype.com/download-oss-sonatype
CSDN 下载地址: http://download.csdn.net/detail/a275109112/9651970
解压:
来到bin目录下 执行:
>> nexus install
>> nexus start
打开:http://localhost:8081/nexus/#welcome
上传JAR到私服
pom配置文件
<distributionManagement>
<snapshotRepository>
<id>snapshots</id>
<name>maven-snapshots</name>
<url>http://127.0.0.1:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>releases</id>
<name>maven-releases</name>
<url>http://127.0.0.1:8081/nexus/content/repositories/releases/</url>
</repository>
</distributionManagement>
setting 配置文件
<servers>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<servers>
注意 pom 里面的id属性要和setting里面的id属性一样
重私服里面下载JAR
setting配件
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>jdk-1.7</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.7</jdk>
</activation>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
</properties>
<!--重私服下载-->
<repositories>
<repository>
<id>nexus</id>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<layout>default</layout>
</repository>
</repositories>
</profile>
</profiles>
更改 public 分组库
执行MVN命令,发布JAR到私服 : clean deploy -e