0
votes

I am using jennkins pipelines, maven and artifactory to build a product, MyProduct.

Plugin A uses the following Artifactory Snapshot Repository.

<distributionManagement>
    <snapshotRepository>
        <id>mvn</id>
        <url>https://bin.mydomain.ch/artifactory/myproduct-repo.mvn/</url>
        <uniqueVersion>false</uniqueVersion>
    </snapshotRepository>
</distributionManagement>

Plugin A builds without a problem and seems to upload to the Company Repo and MyProduct Repo.

Somewhere in the build process something went wrong and the two repositories are not synced, there is an extra artifact in the Company Repo, "*-110.jar & *.110.pm".

Company Repo
Index of mvn/ch/sbb/myproduct/cloud/myproduct-common/2.2.2-SNAPSHOT

maven-metadata.xml                               21-Nov-2018 01:13  781 bytes
myproduct-common-2.2.2-20181116.162503-110.jar   16-Nov-2018 16:25  83.55 KB
myproduct-common-2.2.2-20181116.162503-110.pom   16-Nov-2018 16:25  2.97 KB
myproduct-common-2.2.2-20181120.235538-34.jar    20-Nov-2018 23:55  85.76 KB
myproduct-common-2.2.2-20181120.235538-34.pom    20-Nov-2018 23:55  3.44 KB
myproduct-common-2.2.2-20181121.002820-35.jar    21-Nov-2018 00:28  85.76 KB
myproduct-common-2.2.2-20181121.002820-35.pom    21-Nov-2018 00:28  3.44 KB
myproduct-common-2.2.2-20181121.011343-36.jar    21-Nov-2018 01:13  85.76 KB
myproduct-common-2.2.2-20181121.011343-36.pom    21-Nov-2018 01:13  3.44 KB

MyProduct Repo  
Index of myproduct-repo.mvn/ch/sbb/myproduct/cloud/myproduct-common/2.2.2-SNAPSHOT

maven-metadata.xml                              21-Nov-2018 01:13  781 bytes
myproduct-common-2.2.2-20181120.235538-34.jar   20-Nov-2018 23:55  85.76 KB
myproduct-common-2.2.2-20181120.235538-34.pom   20-Nov-2018 23:55  3.44 KB
myproduct-common-2.2.2-20181121.002820-35.jar   21-Nov-2018 00:28  85.76 KB
myproduct-common-2.2.2-20181121.002820-35.pom   21-Nov-2018 00:28  3.44 KB
myproduct-common-2.2.2-20181121.011343-36.jar   21-Nov-2018 01:13  85.76 KB
myproduct-common-2.2.2-20181121.011343-36.pom   21-Nov-2018 01:13  3.44 KB

When I build plugin B it fetches the dependencies out of the Company Repo and for some reasons it fetches the 110 Snapshot which is the oldest and I get a compilation error. The Company Repo maven-metadata.xml is pointing to artifact 110, whilst the maven-metadata.xml MyProduct Repo is pointing to artifact 37 (the latest and greatest).

How can I tell plugin B to use MyProduct Repo, or at least to take the newest SNAPSHOT artifact?

Is there any jenkins pipepline magic that I can use to emulate false, in other words push to the repository without timestamps (and also pull them)?

How can I recreate maven-metadata.xml on the Company Repo?

1
Use the -U option in Maven...khmarbaise
Unfortunately that didn't have any effect.dasPing

1 Answers

0
votes

How can I tell plugin B to use MyProduct Repo, or at least to take the newest SNAPSHOT artifact?

<distributionManagement>
    <snapshotRepository>
        <id>mvn</id>
        <url>https://bin.mydomain.ch/artifactory/myproduct-repo.mvn/</url>
        <uniqueVersion>false</uniqueVersion>
        <updatePolicy>always</updatePolicy>
    </snapshotRepository>
</distributionManagement>

Add updatePolicy and set its value to "always". This will always pull the latest version of dependencies from the specified URL.

Setting uniqueVersion to false is another topic altogether (Semver violation).

Is there any Jenkins pipeline magic that I can use to emulate false, in other words, push to the repository without timestamps (and also pull them)?

I wouldn't ever recommend doing away with timestamps in Artifactory. That information is valuable for a number of reasons. I understand that you're just looking for a solution to your problem, but by removing timestamps, you are essentially putting a band-aid over an open wound.

How can I recreate maven-metadata.xml on the Company Repo?

Not sure what you mean here. This is updated automatically. You shouldn't be forcing Maven to do anything with this file.