nexus3私服搭建

nexus私服搭建

1.下载nexus最新版本

nexus官网, 下载速度很慢
nexus下载地址

2.下载的是 windows-64.zip

1. 在之前的版本中,启动nexus服务都是在cmd中输入 
2. nexus install来安装服务,nexus start来启动服务。 
3. 在nexus-3.2.0-01中,直接在nexus根目录下的bin下,
4. 输入 nexus.exe/run 即会启动服务。
注意:需要在F:\idea\nexus-3.9.0-01-win64\nexus-3.9.0-01\etc\nexus-default.properties配置ip地址和端口号;

使用管理员权限进入cmd,进入到F:\idea\nexus-3.9.0-01-win64\nexus-3.9.0-01\bin 输入nexus.exe/run启动服务

配置文件
- 启动结果:
启动结果

登录账号密码 admin/admin123
使用参考
nexus界面
maven-central:maven中央库,默认从https://repo1.maven.org/maven2/拉取jar
maven-releases:私库发行版jar
maven-snapshots:私库快照(调试版本)jar
maven-public:仓库分组,把上面三个仓库组合在一起对外提供服务,在本地maven基础配置settings.xml中使用。

  • maven-public

maven-public

3.在maven的setting.xml的配置和项目中的运用!

  1. 对maven的配置文件setting的配置

一般会有一个公共仓库,和一个公司releases仓库,和一个快照仓库

<?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>F:\idea\apache-maven-3.5.3-bin\repository</localRepository>
  <pluginGroups>
    <pluginGroup>org.sonatype.plugins</pluginGroup>
  </pluginGroups>
  <proxies>
  </proxies>
  <servers>
    <server>
      <id>nexus</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
  </servers>
  <mirrors>
    <mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://localhost:7777/repository/maven-public/</url>
    </mirror>
  </mirrors>

  <profiles>
    <profile>
      <id>nexus</id>
      <repositories>
        <repository>
          <id>central</id>
          <url>http://localhost:7777/repository/maven-public/</url>
          <releases>
              <enabled>true</enabled>
              <updatePolicy>always</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://localhost:7777/repository/maven-public/</url>
          <releases>
              <enabled>true</enabled>
              <updatePolicy>always</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
            </releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>

  </profiles>

  <activeProfiles>
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
</settings>

对应的仓库地址:
私服

  • 如果你需要在工程中发布版本,则需要在工程中的pom文件引入:
    <distributionManagement>
        <repository>
            <id>nexus</id>
            <name>Releases</name>
            <url>http://localhost:7777/repository/maven-releases</url>
        </repository>
        <snapshotRepository>
            <id>nexus</id>
            <name>Snapshot</name>
            <url>http://localhost:7777/repository/maven-snapshots</url>
        </snapshotRepository>
    </distributionManagement>
  • 在工程中使用 clean install deploy -X 发布工程到快照版本
    上传结果
  • 在引用jar包的时候,按照原有的引用就可以了;
  • 如果出现引用不了的情况,请重新启动电脑(遇见过该类问题,配置什么的全都是对的,就是引用不了本地上传的jar包,最终重启电脑解决该问题);

  • 补充一点:在实际的开发中我们需要把nexus私服注册成为服务,方便我们的开发;

nexus.exe /install <optional-service-name> #安装
nexus.exe /start <optional-service-name> #开始
nexus.exe /stop <optional-service-name> #结束
nexus.exe /uninstall <optional-service-name> #卸载
#其中<optional-service-name>为服务的名称,可自定义

使用初始化账号密码登录

Nexus初始化账号密码:admin/admin123

当然这些都可以登录进去进行修改。
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值