Maven项目无法加载Snapshot资源

之前写了个项目提交到maven nexus私服,今天其他的项目需要引用这个jar包,发现下载失败,于是便有了这篇文章。
方法一:
配置项目的pom.xml文件

  <repositories>
        <repository>
            <id>test-nexus</id>
            <name>test</name>
            <url>你的私服地址</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

方法二:
配置settings.xml文件

    <profiles>
        <profile>
            <id>nexus</id>
            <repositories>
                <repository>
                    <id>central</id>
                    <name>Nexus</name>
                    <url>你的私服地址</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>central</id>
                    <name>Nexus</name>
                    <url>你的私服地址</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>
    <!-- 配置了profile之后,需要打开配置,否则无用 -->
    <activeProfiles>
        <activeProfile>nexus</activeProfile>
    </activeProfiles>

个人还是推荐settings.xml方式,这样不会影响项目代码,将环境配置带入到项目中。

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 首先私服是一种衍生出来的特殊的Maven远程仓库,构建私服的好处请看3.5私服 可以帮助大家建立私服的仓库管理软件...
    zlcook阅读 10,860评论 0 32
  • |-1-更新内容[6.从仓库解析依赖的机制(重要)] 1Maven仓库作用 仓库用来存储所有项目使用到构件,在ma...
    zlcook阅读 6,543评论 0 25
  • 简介 概述 Maven 是一个项目管理和整合工具 Maven 为开发者提供了一套完整的构建生命周期框架 Maven...
    闽越布衣阅读 4,578评论 6 39
  • Maven的基本了解 什么是Maven? Maven就是Apache下的一个开源项目。它是用纯java开发的。是一...
    Bcome阅读 3,190评论 0 7
  • 晨间检视 高效率慢生活第11 4天 开启运动模式跑步第44天 2018年8月13 号,成都洛带, 天气:晴 温度3...
    蒙蒙简阅读 362评论 0 1

友情链接更多精彩内容