Problems uploading files .pom to nexus

Hello,

I have an on-premise instance of Sonatype Nexus Repository COMMUNITY 3.79.1-04
and I am having problems uploading .pom files. When I upload the artifact,
only the header appears and not all the dependencies. I cannot get the file to upload completely.

These are the commands I have used (with the same result):

curl --location --silent --header 'Accept: application/json' \
-H 'Authorization: Basic dGVzdHVzZXI6dGVzdHVzZXI=' \
--url 'https://nexus-des.riu.net/service/rest/v1/components?repository=maven-releases' \
--header 'Content-Type: multipart/form-data' \
--form 'maven2.groupId="com.riu.architecture"' \
--form 'maven2.artifactId="spring-boot-metric-starter"' \
--form 'maven2.version="2.1.5"' \
--form 'maven2.generate-pom="true"' \
--form 'maven2.packaging="jar"' \
--form 'maven2.asset1=@"spring-boot-metric-starter-2.1.5.jar"' \
--form 'maven2.asset1.extension="jar"' \
--output response.txt --write-out 'HTTP_CODE:%{response_code}'
curl -v -u testuser:testuser \
--upload-file spring-boot-metric-starter-2.1.5.xml \
https://nexus-des.riu.net/service/rest/v1/components?repository=maven-releases/com/riu/architecture/spring-boot-metric-starter/2.1.5/spring-boot-metric-starter-2.1.5.pom
curl -v -u testuser:testuser \
  -F "maven2.generate-pom=false" \
  -F "maven2.asset1=@spring-boot-metric-starter-2.1.5.xml" \
  -F "maven2.asset1.extension=pom" \
  "https://nexus-des.riu.net/service/rest/v1/components?repository=maven-releases"

Do you know what might be happening? I tried to:

Rebuild the index.
Restart my Nexus instance.
Update the Nexus version on a development environment to nexus-3.86.0-08

Original pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.riu.architecture</groupId>
        <artifactId>master-pom</artifactId>
        <version>2.1.13</version>
    </parent>

    <groupId>com.riu.architecture</groupId>
    <artifactId>spring-boot-metric-starter</artifactId>
    <version>2.1.5</version>
    <packaging>jar</packaging>
    <name>spring-boot-metric-starter</name>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-tracing</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-tracing-bridge-brave</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-api</artifactId>
            <version>1.54.1</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>io.opentracing</groupId>
            <artifactId>opentracing-util</artifactId>
            <version>0.33.0</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.riu.architecture</groupId>
            <artifactId>spring-boot-log-starter</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Pom uploaded to nexus:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>com.riu.architecture</groupId>
  <artifactId>spring-boot-metric-starter</artifactId>
  <version>2.1.4</version>
  <packaging>jar</packaging>
</project>

The command in your comment doesn’t include the groupId, the artifactId or the version, so that may be the cause of the problem. Aside from that you’d want to provide the error from curl.

It turned out to be our mistake in the end. We had an Nginx server in front of it, and the cache was modifying the file. Thanks anyway.

Hi Matthew,

First of all, thank you for responding.

Even if I add that information, the curl still uploads incorrectly, as in the example. As for the curl error, the problem is that it doesn’t show any kind of error, it just gives me a 204 response code.

Did you provide the groupId, artifactId and version? Nexus does not parse the pom to determine these.