Java资源分享网 - 专业的Java学习网站 学Java,上Java资源分享网
软件开发基于Nexus的Maven与Npm私有仓库搭建 PDF 下载
匿名网友发布于:2025-09-14 10:56:35
(侵权举报)
(假如点击没反应,多刷新两次就OK!)

软件开发基于Nexus的Maven与Npm私有仓库搭建 PDF 下载 图1

 

资料简介:

 

3)配置repository 
有两种方式:
① 修改settings.xml文件,一劳永逸 
通过在全局的settings文件配置altSnapshotDeploymentRepository 和
altReleaseDeploymentRepository进行发布,只需配置一次,所有项目就都可以发布,无需在多个项目
pom指定

 

  <profiles>
     <profile> <!-- 公司maven私服配置 -->
        <id>company</id> 
    <properties> <!-- 用于配置发布的仓库 -->
            <altReleaseDeploymentRepository>
               companyreleases::default::http://localhost:18081/repository/maven-releases/

           </altReleaseDeploymentRepository>
            <altSnapshotDeploymentRepository>
               companysnapshots::default::http://localhost:18081/repository/maven-snapshots/

           </altSnapshotDeploymentRepository>
        </properties> 
        <repositories> <!-- 用于配置拉取依赖的仓库 -->
            <repository>
                <id>company-nexus</id> <!-- repository id要和server id一致才能正确传
递账号密码 -->
                <url>http://localhost:18081/repository/maven-public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories> 
 </profile>     
<!-- 个人maven私服配置
      <profile>
        <id>person</id>
        ...
      </profile>
      -->    
  </profiles>
  <activeProfiles>
    <activeProfile>company</activeProfile> <!-- 填写要激活得profile id -->
    <!--activeProfile>person</activeProfile--> <!-- 支持激活多个profile -->
  </activeProfiles>