Nexus repo1.maven.org mvn-scalafmt_2.12-1.0.3.pom issue

Is the following the issue or it’s my misunderstanding? Steps to reproduce:

  1. Create nexus maven repository as proxy to repo1.maven.org
  2. Upload: curl -X GET http://my.url/nexus-proxy/org/antipathy/mvn-scalafmt_2.12/1.0.3/mvn-scalafmt_2.12-1.0.3.pom
  3. Download mvn-scalafmt_2.12-1.0.3.pom
  4. Create maven hosted repo
  5. Upload file mvn-scalafmt_2.12-1.0.3.pom into hosted repository

The pom is appeared as mvn-scalafmt_${version.scala.major} artifact - exactly as artifactId within pom file:
mvn-scalafmt_${version.scala.major}

That is what the pom contains - https://repo1.maven.org/maven2/org/antipathy/mvn-scalafmt_2.12/1.0.3/mvn-scalafmt_2.12-1.0.3.pom

Hi, Matthew,
You are right, this is really file mvn-scalafmt_2.12-1.0.3.pom file.
But when I upload it into nexus maven hosted repository I see mvn-scalafmt_${version.scala.major}-1.0.3.pom file. I believe if nexus can parse pom, it can find not only
< artifactId>mvn-scalafmt_${version.scala.major}< /artifact>
but <version.scala.major>2.12</version.scala.major> as well.
q

You haven’t really said how you’re doing this, but I’m guessing using the Upload UI, or the Upload REST API (rather than the maven methods).

The code there doesn’t resolve the pom, it just parses the fields - there is code to fail when the entire field requires resolving the pom. (i.e. ${some.property}) If you like you can open a bug at issues.sonatype.org but likely the fix here would be to fail if any part of the field requires resolving the pom. (Properly resolving the pom requires the context of the entire pom hierarchy.)

I’d recommend just uploading the file to the desired location using curl or similar.

Hi, Matthew,
The result is the same when using either the Upload UI or REST API.
Submitted the issue Wrong uploading mvn-scalafmt_2.12-1.0.3.pom with detailed description.

1 Like