Problem deploying to Maven Repo

Hello all–

I’ve been having a problem deploying (“mvn deploy”) to the OpenMRS Maven repo, which I assume is due to the migration to jfrog? I assume I’ve just making a silly mistake in the configuration, but I can’t see where it is. I’m getting an authorization failure when I’ve got mavenrepo listed as the repo in the pom:

<snapshotRepository>
	<id>openmrs-repo-snapshots</id>
	<name>OpenMRS Snapshots</name>
	<url>http://mavenrepo.openmrs.org/nexus/content/repositories/snapshots</url>
</snapshotRepository>

When I change it to jfrog, it works.

 <snapshotRepository>
        <id>snapshots</id>
        <name>openmrs-snapshots</name>
        <url>https://openmrs.jfrog.io/openmrs/snapshots</url>
   </snapshotRepository>

I think I have my settings.xml configured right, though maybe there’s a silly typo (password redacted):

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>

    <server>
      <username>mogoodrich</username>
      <password></password>
      <id>bintray-sdk</id>
    </server>

    <server>
      <id>openmrs-repo</id>
      <username>mogoodrich</username>
      <password></password>
    </server>

    <server>
      <id>openmrs-repo-modules</id>
      <username>mogoodrich</username>
      <password></password>
    </server>

   <server>
      <id>openmrs-repo-snapshots</id>
      <username>mogoodrich</username>
      <password></password>
    </server>

    <server>
      <id>central</id>
      <username>mogoodrich</username>
      <password></password>
    </server>
     <server>
      <id>snapshots</id>
      <username>mogoodrich</username>
      <password></password>
    </server>

  </servers>
  
<profiles>
    <profile>

      <repositories>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>public</name>
          <url>https://openmrs.jfrog.io/openmrs/public</url>
        </repository>
        <repository>
          <snapshots />
          <id>snapshots</id>
          <name>public</name>
          <url>https://openmrs.jfrog.io/openmrs/public</url>
        </repository>
      </repositories>

      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>public</name>
          <url>https://openmrs.jfrog.io/openmrs/public</url>
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>snapshots</id>
          <name>public</name>
          <url>https://openmrs.jfrog.io/openmrs/public</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>

    </profile>

    <profile>
      <properties>
        <archetypeRepository>http://mavenrepo.openmrs.org/nexus/content/repositories/public</archetypeRepository>
        <archetypeCatalog>http://mavenrepo.openmrs.org/nexus/content/repositories/public/archetype-catalog.xml</archetypeCatalog>
      </properties>
      <repositories>
        <repository>
          <id>openmrs-repo</id>
          <name>OpenMRS Nexus Repository</name>
          <url>http://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
        </repository>
        <repository>
          <id>openmrs-repo-thirdparty</id>
          <name>OpenMRS Thirdparty Nexus Repository</name>
          <url>http://mavenrepo.openmrs.org/nexus/content/repositories/thirdparty</url>
        </repository>
	 <repository>
	  <snapshots />
          <id>openmrs-repo-snapshots</id>
          <name>OpenMRS Snapshots</name>
          <url>http://mavenrepo.openmrs.org/nexus/content/repositories/snapshots</url>
        </repository>
        <repository>
          <id>openmrs-bintray-repo</id>
          <name>OpeMRS Maven Bintray Repository</name>
          <url>https://dl.bintray.com/openmrs/maven/</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>openmrs-repo</id>
          <name>OpenMRS Nexus Repository</name>
          <url>http://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
        </pluginRepository>
        <pluginRepository>
          <id>openmrs-bintray-repo</id>
          <name>OpeMRS Maven Bintray Repository</name>
          <url>https://dl.bintray.com/openmrs/maven/</url>
        </pluginRepository>
      </pluginRepositories>
      <id>openmrs</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
    <activeProfile>openmrs</activeProfile>
  </activeProfiles>
  <pluginGroups>
    <pluginGroup>org.openmrs.maven.plugins</pluginGroup>
  </pluginGroups>
</settings>

Anyway see what I am missing?

I’m assuming the idea is that we should not have to change the pom’s of the modules to point directly to jfrog, but will be keeping the mavenrepo.openmrs.org alias?

fyi @cintiadr @raff

Thanks! Mark

I cannot see the problem here. I have plenty of modules running just fine from Bamboo.

Can you please try the following:

<snapshotRepository>
  <id>openmrs-repo-snapshots</id>
  <name>OpenMRS Snapshots</name>
  <url>https://mavenrepo.openmrs.org/nexus/content/repositories/snapshots</url>

or

<snapshotRepository>
    <id>openmrs-repo-snapshots</id>
    <name>OpenMRS Snapshots</name>
    <url>https://mavenrepo.openmrs.org/snapshots</url>

or

<snapshotRepository>
  <id>snapshots</id>
  <name>OpenMRS Snapshots</name>
  <url>https://mavenrepo.openmrs.org/snapshots</url>

Does any of them work?

Indeed, the idea is keeping the mavenrepo alias and not change the pom to jfrog, so that we will never be locked to jfrog. Of course, we could use JFrog (without the rest of the nexus old URL), but you should not commit a pom file pointing straight to jfrog.

This are the IDs I’m using in Bamboo agents, just in case.

<servers>
<server>
  <id>openmrs-repo-releases</id>
  <username>[redacted]</username>
  <password>[redacted]</password>
</server>
<server>
  <id>openmrs-repo-snapshots</id>
  <username>[redacted]</username>
  <password>[redacted]</password>
</server>
<server>
  <id>openmrs-repo-modules</id>
  <username>[redacted]</username>
  <password>[redacted]</password>
</server>
<server>
  <id>openmrs-repo-contrib</id>
  <username>[redacted]</username>
  <password>[redacted]</password>
</server>

@mogoodrich, please let us know if it is still the issue. It may be related to Maven repository outage/migration

If it is still the issue, does it work if you use mavenrepo-old.openmrs.org instead?

@cintiadr, I noticed https://mavenrepo.openmrs.org uses 301 redirect, whereas https://mavenrepo-old.openmrs.org uses 302. Maybe that’s causing the issue?

Also there’s additional 307 redirect from http://mavenrepo.openmrs.org to https://mavenrepo.openmrs.org, whereas for http://mavenrepo.openmrs.org it’s directly to https://openmrs.jfrog.org. It think this extra redirect may be causing the issue…

So strange… I tried the three different versions of “snapshots” you suggested @cintiadr, plus mavenrepo-old as @raff suggested… still the only thing that works for me is hardcoding it for jfrog:

<snapshotRepository>
        <id>snapshots</id>
        <name>openmrs-snapshots</name>
        <url>https://openmrs.jfrog.io/openmrs/snapshots</url>
   </snapshotRepository>

Since it’s working that case, I assume it’s not me getting my credentials wrong or specifying them in the wrong place.

Just in case this helps, this is the error I’m seeing:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project addresshierarchy: Failed to deploy artifacts: Could not transfer artifact org.openmrs.module:addresshierarchy:pom:2.11.0-20171030.151843-6 from/to openmrs-repo-snapshots (http://mavenrepo.openmrs.org/nexus/content/repositories/snapshots): Failed to transfer file: https://openmrs.jfrog.io/openmrs/snapshots/org/openmrs/module/addresshierarchy/2.11.0-SNAPSHOT/addresshierarchy-2.11.0-20171030.151843-6.pom. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]

Thanks! Mark

Indeed. If you are using the same ID, it should send same credentials, and work. It appears correct, really.

Does anyone else have the same problem?

Anyway, give me your exact maven version and java version, and the repository, I will see what I can find.

Here’s the mvn and java versions I’m using on my laptop.

That being said I’m actually using my old laptop now while the screen is repaired on my current one… I don’t want to spend too much time installing different java versions, etc, on it when I’ll hopefully be going back to to my new one next week… so don’t worry about spending too much time on this now unless you see something oibvious. I’ll let you know what happens when I switch back… I can try installing Oracle Java vs OpenJDK, etc, then as well,

Will comment on the other issue I’m facing with the PIH bamboo server on the other thread…

mogoodrich@mogoodrich-ThinkPad-T510:~$ mvn -v
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 11:22:22-0400)
Maven home: /usr/local/apache-maven/apache-maven-3.1.1
Java version: 1.7.0_151, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-133-generic", arch: "amd64", family: "unix"
mogoodrich@mogoodrich-ThinkPad-T510:~$ java -version
java version "1.7.0_151"
OpenJDK Runtime Environment (IcedTea 2.6.11) (7u151-2.6.11-0ubuntu1.14.04.1)
OpenJDK 64-Bit Server VM (build 24.151-b01, mixed mode)
mogoodrich@mogoodrich-ThinkPad-T510:~$
1 Like

Just bringing this back up, is there are baseline settings.xml for Bintray deployment that can be used for maven based releases and deployment. I am struggling to find something that works so not sure if it is permissions on my configuration