Can not upload jar file to nexus 3 wheras the pom file is uploaded

53 views Asked by At

I have a simple spring boot application that I deploy to the repository manager nexus via the command mvn clean deploy. The issue is after running the maven command, I can see that the packaged pom file is uploaded whereas the jar file is not uploaded with an error message.

The pom file:

<?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>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.2.3</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>org.billing</groupId>
    <artifactId>billing-service</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>billing-service</name>
    <description>billing-service</description>


    <properties>
        <java.version>17</java.version>
    </properties>

    <distributionManagement>
        <snapshotRepository>
            <id>nexus.snapshot</id>
            <name>nexus-snapshot</name>
            <url>http://IP-ADDRESS/repository/billing-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

And I am getting the error:

[INFO] --- maven-deploy-plugin:3.1.1:deploy (default-deploy) @ billing-service ---
Downloading from nexus.snapshot: http://IP-ADDRESS/repository/billing-snapshots/org/billing/billing-service/0.0.1-SNAPSHOT/maven-metadata.xml
Uploading to nexus.snapshot: http://IP-ADDRESS/repository/billing-snapshots/org/billing/billing-service/0.0.1-SNAPSHOT/billing-service-0.0.1-20240305.221751-1.pom
Uploaded to nexus.snapshot: http://IP-ADDRESS/repository/billing-snapshots/org/billing/billing-service/0.0.1-SNAPSHOT/billing-service-0.0.1-20240305.221751-1.pom (2.4 kB at 1.8 kB/s)
Uploading to nexus.snapshot: http://IP-ADDRESS/repository/billing-snapshots/org/billing/billing-service/0.0.1-SNAPSHOT/billing-service-0.0.1-20240305.221751-1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  19.894 s
[INFO] Finished at: 2024-03-05T23:18:11+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy (default-deploy) on project billing-service: Failed to deploy artifacts: Could not transfer artifact org.billing:billing-service:jar:0.0.1-2024
0305.221751-1 from/to nexus.snapshot (http://IP-ADDRESS/repository/billing-snapshots/): transfer failed for http://IP-ADDRESS/repository/billing-snapshots/org/billing/billing-service/0.0.1-SNAPSHOT/billing-servic
e-0.0.1-20240305.221751-1.jar: Connection reset by peer -> [Help 1]

Even I add the packaging jar tag to the pom file, it did not work. As the error log recommend, I run the mvn deploy on debug mode, I noticed this indication but I don't undestand what it means:

[DEBUG] Failed to dispatch transfer event 'PUT PROGRESSED http://IP-ADDRESS/repository/billing-snapshots/org/billing/billing-service/0.0.1-SNAPSHOT/billing-service-0.0.1-20240305.220831-1.jar <> C:\Users\ergai\Desktop\devo
ps-digital-oceans-projects\billing-service\target\billing-service-0.0.1-SNAPSHOT.jar' to org.apache.maven.cli.transfer.ConsoleMavenTransferListener
java.lang.IllegalArgumentException: progressed file size cannot be greater than size: 64430080 > 22686224
1

There are 1 answers

0
Techies On

Network problem, hard to figure what's going on.

Check:

  • That your nexus is available with a browser
  • Check your repository is browseable.
  • Check that your repository path is correct and is accessible in nexus repository options
  • Check that there is not a firewalld on your computer and/or nexus server that prevent you from connecting.
  • Are you sure your nexus does not use https? These kind of errors messages are often related to TLS issues (incompatibilty).
  • Check your repository accept SNAPSHOT