• 企业400电话
  • 微网小程序
  • AI电话机器人
  • 电商代运营
  • 全 部 栏 目

    企业400电话 网络优化推广 AI电话机器人 呼叫中心 网站建设 商标✡知产 微网小程序 电商运营 彩铃•短信 增值拓展业务
    Nexus私服的搭建原理及教程解析

    一.为什么要构建Nexus私服?

    公司所有开发成员没有外网,通过局域网连接 nexus 私服,由私服连接外网。

    把项目发布到私服.其他人员从私服下载。

    二.使用私服之后架构图

    三.搭建 Nexus

    3.1 nexus-2.10-1bundle.zip 解压到任意非中文目录中

    3.2进入 nexus-2.10-1\bin\jsw\indows-x86-4(对应自己系统)

    以windows64系统为例

    3.3 登录后台

    在浏览器输入 htp:/localhost:8081/nexus

    默认端口8081
    默认用户名admin
    默认密码admin123

    若需调整可配置nexus-2.10-1\conf\exus.proerties

    四.使用 maven 连接私服

    4.1修改maven 的 setings.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <settings>
      <localRepository>G:\tool\m2\myrepository</localRepository>
      <mirrors>
    
        <mirror>
          <id>nexus-releases</id>
          <mirrorOf>*</mirrorOf>
          <url>http://localhost:8081/nexus/content/groups/public</url>
        </mirror>
        <mirror>
          <id>nexus-snapshots</id>
          <mirrorOf>*</mirrorOf>
          <url>http://localhost:8081/nexus/content/repositories/apache-snapshots/
          </url>
        </mirror>
      </mirrors>
    
    
      <profiles>
        <profile>
          <id>jdk-1.7</id>
          <activation>
            <activeByDefault>true</activeByDefault>
            <jdk>1.7</jdk>
          </activation>
          <properties>
            <maven.compiler.source>1.7</maven.compiler.source>
            <maven.compiler.target>1.7</maven.compiler.target>
            <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
          </properties>
        </profile>
    
    
    
        <profile>
          <id>nexusTest</id>
          <repositories>
            <repository>
              <id>local-nexus</id>
              <url>http://127.0.0.1:8081/nexus/content/groups/public/</url>
              <releases>
                <enabled>true</enabled>
              </releases>
              <snapshots>
                <enabled>true</enabled>
              </snapshots>
            </repository>
          </repositories>
        </profile>
    
    
      </profiles>
    
    
      <activeProfiles> <!--激活 id为 nexusTest的 profile -->
        <activeProfile>nexusTest</activeProfile>
      </activeProfiles>
      <servers>
        <server>
          <id>releases</id>
          <username>admin</username>
          <password>admin123</password>
        </server>
        <server>
          <id>snapshots</id>
          <username>admin</username>
          <password>admin123</password>
        </server>
      </servers>
    </settings>

    G:\tool\m2\myrepository 存放本地仓库位置

    http://127.0.0.1:8081 Nexus服务器ip及端口

    admin/ admin123 Nexus服务器登录用户名和密码

    五.把项目发布到私服的步骤

    5.1 pom.xml 中配置私服路径

    <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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.bjsxt</groupId>
      <artifactId>test</artifactId>
      <version>0.0.1-SNAPSHOT</version>
    
      <distributionManagement>
        <repository>
          <id>releases</id>
          <url>http://localhost:8081/nexus/content/repositories/releases</url>
        </repository>
        <snapshotRepository>
          <id>snapshots</id>
          <url>http://localhost:8081/nexus/content/repositories/snapshots</url>
        </snapshotRepository>
      </distributionManagement>
    
    </project>

    5.2 在 setings.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>

    5.3 右键项目-> run as 输入 deploy

    添加到项目后,后台可查询到对应包

    以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。

    上一篇:基于Nexus实现配置阿里云代理仓库过程解析
    下一篇:Centos7实现MySQL基于日志还原数据的示例代码
  • 相关文章
  • 

    © 2016-2020 巨人网络通讯

    时间:9:00-21:00 (节假日不休)

    地址:江苏信息产业基地11号楼四层

    《增值电信业务经营许可证》 苏B2-20120278

    Nexus私服的搭建原理及教程解析 Nexus,私服,的,搭建,原理,