美文网首页
win10使用nexus3.x

win10使用nexus3.x

作者: 码农梦醒 | 来源:发表于2020-09-15 08:50 被阅读0次

下载并启动登录

  1. 下载nexus-3.25.0-03.zip
  2. 解压下载到的压缩包
    3.进入nexus-3.25.0-03\bin目录
    4.控制台执行nexus.exe run
    5.访问http://localhost:8081/
    6.账号为admin, 密码则可以看到界面的提示, 打开界面中提示路径下的文件,里面的内容就是密码

p.s. nexus默认端口为8081,想修改默认端口,修改nexus-3.25.0-03\etc\nexus-default.properties文件即可

nexus概念

三种类型的仓库

  • hosted 宿主仓库:主要用于部署无法从公共仓库获取的构件以及自己或第三方的项目构件;
  • proxy 代理仓库:代理公共的远程仓库;
  • group 仓库组:Nexus 通过仓库组统一管理多个仓库,这样我们在项目中直接请求仓库组即可请求到仓库组管理的多个仓库。

Nexus预定义了2个本地仓库,分别是maven-releases, maven-snapshots。

maven-releases:这里存放我们自己项目中发布的构建, 通常是Release版本的。
maven-snapshots:这个仓库非常的有用, 它的目的是让我们可以发布那些非release版本, 非稳定版本。

在maven中配置私库

maven的setting.xml文件

<servers>
    <server>
    <!--这是server的id(注意不是用户登陆的id),该id与distributionManagement中repository元素的id相匹配。 -->
      <id>nexus</id>
      <username>admin</username>
      <password>admin123</password>
     </server>
</servers>

<!--为仓库列表配置的下载镜像列表。  -->
<mirrors>
    <mirror>
        <!--该镜像的唯一标识符。id用来区分不同的mirror元素。  -->
        <id>nexus</id>
        <!--此处配置所有的构建均从私有仓库中下载 *代表所有,也可以写central -->
        <mirrorOf>*</mirrorOf>
        <name>central repository</name>
        <!--该镜像的URL。构建系统会优先考虑使用该URL,而非使用默认的服务器URL。  -->
        <url>http://127.0.0.1:8081/repository/maven-public/</url>
    </mirror>
</mirrors>

<profiles>
  <profile>
      <id>nexus</id>
      <!--远程仓库列表,它是Maven用来填充构建系统本地仓库所使用的一组远程项目。  -->
      <repositories>
          <!--发布版本仓库-->
          <repository>
              <id>nexus</id>      
              <!--地址是nexus中repository(Releases/Snapshots)中对应的地址-->
              <url>http://127.0.0.1:8081/repository/maven-public/</url>
          <!--true或者false表示该仓库是否为下载某种类型构件(发布版,快照版)开启。 -->
          <releases>
              <enabled>true</enabled>
          </releases>
          <snapshots>
              <enabled>true</enabled>
          </snapshots>
      </repository>
      </repositories>
  </profile>     
</profiles>

<!--激活配置-->
<activeProfiles>
    <!--profile下的id-->
    <activeProfile>nexus</activeProfile>
</activeProfiles>

通过命令上传jar包到nexus

mvn deploy:deploy-file -DgroupId=com.sgcc.ams -DartifactId=ams-base -Dversion=1.7.0 -Dpackaging=jar -Dfile=C:\develop\lib\ams-base-1.7.0.jar -Durl=http://127.0.0.1:8081/repository/maven-releases/ -DrepositoryId=nexus

在项目中配置私库
pom.xml

<!--上传到nexus仓库中,配合mvn deploy:deploy-->
<distributionManagement>
    <repository>
        <id>nexus</id>
        <name>Nexus snapshots Repository</name>
        <!--snapshots仓库 -->
        <url>http://127.0.0.1:8081/repository/maven-snapshots/</url>
    </repository>
</distributionManagement>

搭建npm私服

创建blob存储

为其创建一个单独的存储空间
![image.png](https://upload-images.jians
hu.io/upload_images/1890600-430f98899b0ae24d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

创建hosted类型的npm

image.png

创建一个proxy类型的npm仓库

image.png

创建一个group类型的npm仓库

image.png

验证使用

首先获取默认的仓库地址

# npm config get registry
https://registry.npmjs.org/

配置为私服地址

image.png

通过如下命令配置:

# npm config set registry http://192.168.75.11:8081/repository/group-npm/
# npm config get registry
http://192.168.75.11:8081/repository/group-npm/

现在开始安装,安装之前先看一下组里的内容:


image.png

可以看到还是空的。

安装编译

前端框架网址:https://wepyjs.github.io/wepy-docs/2.x/

npm install @wepy/cli -g

在编译的过程中,我们已经可以看看组里的变化了:


image.png

参考文章

win10安装最新nexus-3.x及maven简单配置介绍

nexus3安装和使用

使用nexus3配置npm私有仓库

将npm包发布在私有仓库(nexus)中

相关文章

  • win10使用nexus3.x

    下载并启动登录 下载nexus-3.25.0-03.zip 解压下载到的压缩包3.进入nexus-3.25.0-0...

  • 使用nexus搭建内网maven镜像

    背景: 内网环境,使用maven构建管理项目只能自己搭建镜像。nexus3.x需联网使用,所以选用nexus2.x...

  • maven私服

    使用私服 Maven 自动打包上传到私服 Nexus 自动打包上传私服(nexus3.X版本改了很多) Repos...

  • Win10上使用Docker【三】

    《Win10上使用Docker【一】》:Docker在Win10上的部署方法 《Win10上使用Docker【二】...

  • Win10上使用Docker【二】

    《Win10上使用Docker【一】》:Docker在Win10上的部署方法 《Win10上使用Docker【二】...

  • Win10上使用Docker【一】

    《Win10上使用Docker【一】》:Docker在Win10上的部署方法 《Win10上使用Docker【二】...

  • 2019-01-04 nexus 3.x 迁移

    1. nexus3.x与nexus2.x在maven仓库的区别 nexus3.x 不支持将本地的maven仓库整体...

  • nuget 与 nexus3.x

    上文已介绍过nexus3.x的安装,本文介绍nuget的使用 1.设置项目生成nuget包 2.上传 nuget ...

  • Win10怎么删除壁纸使用记录

    Win10怎么删除壁纸使用记录_百度知道 Win10怎么删除壁纸使用记录 工具:电脑 步骤: 1、在Win10中默...

  • u行侠u盘装原版win10系统教程

    教程导读 什么是U盘装原版Win10系统,怎么使用U盘装原版Win10系统?怎么使用U行侠装原版Win10系统?此...

网友评论

      本文标题:win10使用nexus3.x

      本文链接:https://www.haomeiwen.com/subject/ryexyktx.html