概述
nexus3使用
仓库名 | 作用 |
---|---|
hosted(宿主仓库库) | 存放本公司开发的jar包(正式版本、测试版本) |
proxy(代理仓库) | 代理中央仓库、Apache下测试版本的jar包 |
group(组仓库) | 使用时连接组仓库,包含Hosted(宿主仓库)和Proxy(代理仓库) |
virtual (虚拟仓库) | … |
创建代理仓库
https://jcenter.bintray.com/
, 创建 jcenter
代理
将创建的代理 仓库加入 maven-public 组这个仓库
maven-public 这个仓库类型是 group ,意思是可以将代理类型和host类型相互组合, 通常 pom 文件指向的也是这个maven库
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>/opt/soft/lib/repo</localRepository>
<servers>
<!--上傳到私服時需要配置-->
<server>
<id>nexus_release</id>
<username>dev</username>
<password>dev111</password>
</server>
<server>
<id>nexus_snapshot</id>
<username>dev</username>
<password>dev111</password>
</server>
</servers>
<mirrors>
<!--如果central*找不到,則到aliyun鏡像找 -->
<mirror>
<id>aliyunmaven</id>
<mirrorOf>central*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>jdk-15</id>
<activation>
<jdk>15</jdk>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>central</id>
<url>http://192.168.1.15:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://192.168.1.15:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
工程 pom 上傳到私服
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!--
<server>
<id>nexus_release</id> (1)
<username>dev</username>
<password>dev111</password>
</server>
<server>
<id>nexus_snapshot</id>
<username>dev</username>
<password>dev111</password>
</server>
-->
<distributionManagement>
<repository>
<id>nexus_release</id> <!--和setting文件中的 server 標籤下的 id (1)一致,不然找不到-->
<name>Nexus Release Repository</name>
<url>http://192.168.1.15:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus_snapshot</id>
<name>Nexus Snapshot Repository</name>
<url>http://192.168.1.15:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
good luck !
最后
以上就是能干野狼为你收集整理的maven-私服 nexus3 使用的全部内容,希望文章能够帮你解决maven-私服 nexus3 使用所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复