org.sonatype.nexus.repository.InvalidContentException: Invalid maven-metadata.xml

Hi,
While publishing maven-metadata file getting error as below, any suggestion please on what went wrong here

Metadata file has repository name as groupId.

2022-12-07 09:38:44,301+0000 WARN [qtp1083752578-11666] cs-writer-sa org.sonatype.nexus.repository.maven.internal.validation.MavenMetadataContentValidator - maven-metadata.xml path gdi_us_processes/maven-metadata.xml does not match the expected path csua-maven-release/gdi_us_processes/maven-metadata.xml
2022-12-07 09:38:44,301+0000 WARN [qtp1083752578-11666] cs-writer-sa org.sonatype.nexus.repository.maven.internal.orient.MavenFacetImpl - org.sonatype.nexus.repository.InvalidContentException: Invalid maven-metadata.xml GAV csua-maven-release, gdi_us_processes, null does not match request path gdi_us_processes/maven-metadata.xml
2022-12-07 09:38:44,343+0000 WARN [qtp1083752578-11666] cs-writer-sa org.sonatype.nexus.repository.view.handlers.ExceptionHandler - Invalid content: PUT /gdi_us_processes/maven-metadata.xml: org.sonatype.nexus.repository.InvalidContentException: Invalid maven-metadata.xml GAV csua-maven-release, gdi_us_processes, null does not match request path gdi_us_processes/maven-metadata.xml

xml file looks like,

<?xml version="1.0" encoding="UTF-8"?> csua-maven-release gdi_us_processes 3.2-0.noarch 3.2-0.noarch 3.1-1.noarch 3.1-2.noarch 3.1-3.noarch 3.1-5.noarch 3.1-6.noarch 3.1-7.noarch 3.1-8.noarch 3.1-9.noarch 3.2-0.noarch 20221117064431

Using Sonatype Nexus Repository ManagerOSS 3.30.0-0

Thanks,
Ramakrishna

Version 3.30.0 is really old. There’s a high chance this was a bug we have fixed in one of past release. Please try again using the most recent version of Nexus Repository and let us know if the problem persists.

Thanks for the response, I tried to upload on a different nexus server running on below version. Saw same error. Can we have Repository name as groupId in the metadata.xml file as we are seeing invalid content exception?

Sonatype Nexus Repository ManagerOSS 3.39.0-01

The current latest release is 3.43.0. The XML you posted does not look like an XML file at all, but I suspect it’s due to wrong formatting of your post. I think your XML file is incorrect, because you’re trying to post maven-metadata.xml for csua-maven-release:gdi_us_processes:null on a path of gdi_us_processes groupId. What Maven version and command are you using when you get this error log?

Hi Dawid,
xml file looks like below, using curl command to upload this file to a repository named csua-maven-release. This repo name and groupId are same here

curl -v -u cs-writer-sa:‘xxxxx’ --upload-file maven-metadata.xml https://xxxx/repository/csua-maven-release/gdi_us_processes/maven-metadata.xml

<?xml version="1.0" encoding="UTF-8"?>
 <metadata>
   <groupId>csua-maven-release</groupId>
   <artifactId>gdi_us_processes</artifactId>
 <versioning>
  <latest>3.2-0.noarch</latest>
  <release>3.2-0.noarch</release>
  <versions>
  <version>3.1-1.noarch</version>
  <version>3.1-2.noarch</version>
  <version>3.1-3.noarch</version>
  <version>3.1-5.noarch</version>
  <version>3.1-6.noarch</version>
  <version>3.1-7.noarch</version>
  <version>3.1-8.noarch</version>
  <version>3.1-9.noarch</version>
  <version>3.2-0.noarch</version>
 </versions>
 <lastUpdated>20221117064431</lastUpdated>
 </versioning>
</metadata>

Oh, I see. In this case there is no bug in Nexus Repository here. You’re uploading it wrong and Nexus Repository is telling you exactly what’s wrong in the error log you originally posted. Either use Maven client that will do it correctly or adjust your path or your XML.