nexus 3
- nexus 的作用
-
- 下載下傳
- 安裝
- 配置
- mvn deploy
- 問題
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