maven---私服

私服:是一种特殊的远程仓库,它是架设在局域网内的仓库

需要jar包时,从私服上找,如果没有,私服从中央仓库上下,中央仓库除版权jar包以外,都有,下到私服上,由私服返回,如果有,直接由私服返回。

配置私服

将nexus-2.1.2.war复制到服务器上,例如:tomcat/webapps目录下(哈哈哈。。。。),启动服务器(tomcat),nexus-2.1.2.war自动解压。

安装好之后可以访问:

localhost:8080/nexus-2.1.2

登陆  用户名admin  密码admin123

配置:

配置所有构建均从私服下载,在本地settin.xml中配置,url为public仓库的地址

<mirrors>

 <mirror>

 <id>nexus</id>

 <mirrorOf>*</mirrorOf>

 <url>http://192.168.1.100:8000/nexus/content/groups/public</url>

 </mirror>

 </mirrors>

在配置profiles

 <profiles>

 <profile>

 <id>nexus</id>

 <!--所有请求均通过镜像 -->

 <repositories>

 <repository>

 <id>central</id>

 <url>http://central</url>

 <releases><enabled>true</enabled></releases>

   <snapshots><enabled>true</enabled></snapshots>

 </repository>

 </repositories>

 <pluginRepositories>

 <pluginRepository>

 <id>central</id>

 <url>http://central</url>

 <releases><enabled>true</enabled></releases>

 <snapshots

 </profiles>

<activeProfiles>

 <!--make the profile active all the time -->

 <activeProfile>nexus</activeProfile>

 </activeProfiles>

部署构建到Nexus,包含Release和Snapshot,在项目根目录中pom.xml(父工程)中配置:

<distributionManagement>

<repository>

    <id>releases</id>

    <name>Internal Releases</name>     <url>http://localhost:8000/nexus/content/repositories/releases/</url>

</repository>

<snapshotRepository>

    <id>snapshots</id>

    <name>Internal Snapshots</name>     <url>http://localhost:8000/nexus/content/repositories/snapshots/</url>

</snapshotRepository>

  </distributionManagement>

Nexus的访问权限控制,在本地setting.xml中配置如下:

<!-- 设置发布时的用户名 -->

 <servers>

  <server>

  <id> releases </id>

<username>admin</username>

<password>admin123</password>

</server>

<server>

<id> snapshots </id>

<username>admin</username>

<password>admin123</password>

 </server>

 </servers>><enabled>true</enabled></snapshots>

 </pluginRepository>

 </pluginRepositories>

 </profile>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值