windows服务器maven私服搭建

    Windows系统,通过nexus来搭建maven私服

1.下载地址

  https://www.sonatype.com/download-oss-sonatype


2.安装步骤

  解压到指定文件夹下


   我这里直接点击nexus.exe会闪退,所以在cmd窗口中进行操作

 

 

安装:nexus.exe /install
卸载:nexus.exe /unistall
启动:nexus.exe /start
停止:neuxs.exe /stop

3.安装完成并启动后,直接访问:127.0.0.1:8081(默认端口)

用户名:admin    密码:admin123

修改端口,只需找到配置文件





4.访问界面




5.settings.xml设置

  (1)从私服中下载jar包

     添加一个镜像

    <mirror>   
      <id>maven-public</id>
      <mirrorOf>*</mirrorOf>   
      <url>http://****/repository/maven-public/</url>   
    </mirror>


  <profiles>  
    <profile>  
      <id>nexus</id>  
      <repositories>   
        <repository>  
          <id>maven-public</id>  
          <url>http://maven-public</url>  
          <releases><enabled>true</enabled></releases>  
          <snapshots><enabled>true</enabled></snapshots>  
        </repository>   
        <repository>  
          <id>maven-releases</id>  
          <url>http://maven-releases</url>  
          <releases><enabled>true</enabled></releases>  
          <snapshots><enabled>true</enabled></snapshots>  
        </repository>  
        <repository>  
          <id>maven-snapshots</id>  
          <url>http://maven-snapshots</url>  
          <releases><enabled>true</enabled></releases>  
          <snapshots><enabled>true</enabled></snapshots>  
        </repository>  
      </repositories>  
      <pluginRepositories>  
                 <pluginRepository>  
                 <id>maven-public</id>  
                 <url>http://maven-public</url>  
                 <releases><enabled>true</enabled></releases>  
                 <snapshots><enabled>true</enabled></snapshots>  
               </pluginRepository>  
                 <pluginRepository>  
                 <id>maven-releases</id>  
                 <url>http://maven-releases</url>  
                 <releases><enabled>true</enabled></releases>  
                 <snapshots><enabled>true</enabled></snapshots>  
               </pluginRepository>    
               <pluginRepository>  
                 <id>maven-snapshots</id>  
                  <url>http://maven-snapshots</url>  
                <releases><enabled>true</enabled></releases>  
                 <snapshots><enabled>true</enabled></snapshots>  
             </pluginRepository>  
         </pluginRepositories>  
    </profile>  
  </profiles>  
 
  <activeProfiles>  
      <activeProfile>nexus</activeProfile>  
  </activeProfiles> 

   (2)将jar包deploy到私服上

   settings.xml 授权

   <servers>  
      <server>  
      <id>maven-public</id>  
      <username>admin</username>  
      <password>admin123</password>  
    </server>  
      <server>  
      <id>maven-releases</id>  
      <username>admin</username>  
      <password>admin123</password>  
    </server>  
    <server>  
      <id>maven-snapshots</id>  
      <username>admin</username>  
      <password>admin123</password>  
    </server>  
  </servers>

  pom.xml文件设置

   <distributionManagement>
        <repository>
            <id>maven-releases</id>
            <name>Nexus Release Repository</name>
            <url>http://****/repository/maven-releases/</url>
        </repository>
        <snapshotRepository>
            <id>maven-snapshots</id>
            <name>Nexus Snapshot Repository</name>
            <url>http://****/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

6.在components中找jar包



7.将下载的jar包发布到私服上

mvn deploy:deploy-file -DgroupId=com.alipay -DartifactId=alipay-sdk -Dversion=1.0 -Dpackaging=jar -Dfile=C:/Users/Desktop/alipay-sdk-java20170307171631.jar -Durl=http://192.168.1.216:8181/repository/maven-releases/ -DrepositoryId=maven-releases

修改相应参数(打包时应放到releases里)


8.批量删除lastUpdate文件

 进入仓库目录下

for / r % i in ( * .lastUpdated ) do del % i

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值