nexus 的作用
指定私服的中央地址、将自己的Maven项目指定到私服地址、从私服下载中央库的项目索引、从私服仓库下载依赖组件、将第三方项目jar上传到私服供其他项目组使用
下载
下载地址:https://www.sonatype.com/download-oss-sonatype
百度网盘:
链接: https://pan.baidu.com/s/1zrKiwe46Fa6-aVXUYNpUuQ 提取码: 55x7
安装
解压后,目录bin,执行
./nexus start
./nexus status
nexus is running.
打开http://localhost:8081/,admin/admin123
配置
- setting
<server>
<id>kaizhuo-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>kaizhuo-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
<profile>
<id>dev</id>
<repositories>
<repository>
<id>Nexus</id>
<url>http://localhost:8081/repository/kaizhuo-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<!-- 插件仓库,maven的运行依赖插件,也需要从私服下载插件 -->
<pluginRepository>
<!-- 插件仓库的id不允许重复,如果重复后边配置会覆盖前边 -->
<id>public</id>
<name>kaizhuo-public</name>
<url>http://localhost:8081/repository/kaizhuo-public/</url>
</pluginRepository>
</pluginRepositories>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
<activeProfiles>
<activeProfile>dev</activeProfile>
</activeProfiles>
- pom
<distributionManagement>
<repository>
<id>kaizhuo-releases</id>
<name>kaizhuo-release</name>
<url>http://localhost:8081/repository/kaizhuo-release/</url>
</repository>
<snapshotRepository>
<id>kaizhuo-snapshots</id>
<name>kaizhuo-snapshots</name>
<url>http://localhost:8081/repository/kaizhuo-snapshots/</url>
</snapshotRepository>
</distributionManagement>
mvn deploy
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
version后缀要有SNAPSHOT
mvn deploy
问题
- mvn deploy 405
distributionManagement的URL设置有问题,复制nexus配置Repositories中的URL