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.xxxx.xxx 的父 POM:subpoject1:[unknown-version]: 找不到工件.....并且“parent.relativePath”指向错误的本地 POM @ 第 7 行第 10 列*

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

父pom的pom配置

<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>

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

子项目 1 的 pom 配置

    <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 配置

<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>
4

1 回答 1

0

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

于 2021-02-15T11:17:29.690 回答