首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当我只更新项目的pom版本时,如何防止Maven从存储库下载工件

当我只更新项目的pom版本时,如何防止Maven从存储库下载工件
EN

Stack Overflow用户
提问于 2021-02-15 18:43:45
回答 1查看 200关注 0票数 0

我使用Maven作为CI,使用JFrog Artifactory作为我自己的工件的存储库和缓存。一切都很好。我正在使用Jenkins中的Artifactory插件来触发工件下载和上传。我不知道如何处理下面的用例。我有一个多模块的项目。在我的Settings.xml中,我定义了一些快照、插件和发布存储库。在我的本地工作区中,我升级了父项目及其子项目的pom版本。然后我做了一个本地的干净安装。它失败了,因为Maven试图从Artifactory下载我的项目的工件,而这些工件当然不存在,因为我正在尝试创建项目的新版本。如何处理这种用例?如何配置我的pom或设置呢?如何在Jenkins的Artifactory插件中以一种自由的方式做到这一点?

我收到的错误消息如下:

10:23:28传输失败无法在xxx中找到元数据com.xxx.xxxx.xxx:my-parent-project:3.0.0-SNAPSHOT/maven-metadata.xml 10:23:50 com.xxx.xxx.xxx:subpoject1:未知-版本:无法在错误的本地POM @第7行,第10列找到工件.....and 'parent.relativePath‘点

=====================================

父pom的pom配置

代码语言:javascript
复制
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxx.xxx.xxx</groupId>
<artifactId>my-parent-project</artifactId>
<version>3.0.0-SNAPSHOT</version>
<packaging>pom</packaging>


<modules>
    <module>../subproject-1</module>
    <module>../subproject-2</module>
</modules>

==================================

subproject1的pom配置

代码语言:javascript
复制
    <artifactId>subproject-1</artifactId>

<parent>
    <groupId>com.xxx.xxx.xxx</groupId>
    <artifactId>my-parent-project</artifactId>
    <version>3.0.0-SNAPSHOT</version>
</parent>

======================================

这是我的settings.xml配置

代码语言:javascript
复制
<profile>
        <id>artifactory_profile</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <repositories>
            <repository>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
                <id>central</id>
                <name>libs-release</name>
                <url>http://xxxxxxxxxxxx:8081/artifactory/libs-release</url>
            </repository>
            <repository>
                <snapshots />
                <id>snapshots</id>
                <name>libs-snapshot</name>
                <url>http://xxxxxxxxxxxx:8081/artifactory/libs-snapshot</url>
            </repository>

            <repository>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
                <id>sing</id>
                <name>sing-virtual-repo</name>
                <url>http://xxxxxxxxxxxx:8081/artifactory/virtual-repo</url>
            </repository>               
        </repositories>

        <pluginRepositories>
            <pluginRepository>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
                <id>central</id>
                <name>plugins-release</name>
                <url>http://xxxxxxxxxxxx:8081/artifactory/plugins-release</url>
            </pluginRepository>
            <pluginRepository>
                <snapshots />
                <id>snapshots</id>
                <name>plugins-release</name>
                <url>http://xxxxxxxxxxxx:8081/artifactory/plugins-release</url>
            </pluginRepository>
        </pluginRepositories>
    </profile>
EN

回答 1

Stack Overflow用户

发布于 2021-02-15 19:17:30

如果您在父POM上运行clean install,那么一切都将被正确创建。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66206539

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档