0
votes

I'm using Maven as CI and JFrog Artifactory as a repository of my own artifacts and as a cache. Everything works fine. I'm using the Artifactory plugin in Jenkins to trigger artifact download and upload. I cannot figure how to handle the following use case. I have a multi-module project. In my Settings.xml I defined some snapshot, plugin, and release repositories. In my local workspace, I upgraded the pom version of the parent project and its children. Then I made a local clean install. It failed because Maven was trying to download the artifacts of my project from Artifactory and they don't exist of course because I'm trying to create a new version of the project. How to handle this use case? How to configure my pom or settings to do? How to do this in the Artifactory plugin in Jenkins in a freestyle way?

I have error messages like this :

10:23:28 Failed to transfer Could not find metadata com.xxx.xxxx.xxx:my-parent-project:3.0.0-SNAPSHOT/maven-metadata.xml in xxx 10:23:50 [FATAL] Non-resolvable parent POM for com.xxx.xxxx.xxx:subpoject1:[unknown-version]: Could not find artifact .....and 'parent.relativePath' points at wrong local POM @ line 7, column 10*

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

pom configuration of the parent 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>

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

pom configuration for subproject1

    <artifactId>subproject-1</artifactId>

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

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

Here is my settings.xml configuration

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

1 Answers

0
votes

If you run clean install on the parent POM, then everything will be created correctly.