1
votes

Deploying to my local artifactory/nexus with maven works fine for sample Spring Boot applications (generated on start.spring.io):

mvn clean package deploy

However as soon as I add a dependency from org.springframweork.cloud to my pom:

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-zipkin</artifactId>
    </dependency>

then the deploy fails with "Connection reset" on the client side. artifactory.log shows

2017-02-07 12:57:59,788 [http-nio-8081-exec-10] [INFO ] (o.a.e.UploadServiceImpl:516) - Deploy to 'snapshot-local:com/test/artifactory-demo/0.0.1-SNAPSHOT/artifactory-demo-0.0.1-20170207.125744-10.jar' Content-Length: 21658959
2017-02-07 12:58:03,256 [http-nio-8081-exec-10] [WARN ] (o.a.w.s.RepoFilter  :222) - Sending HTTP error code 404: Failed to read stream: Unexpected EOF read on the socket
2017-02-07 12:58:59,540 [http-nio-8081-exec-2] [WARN ] (o.a.w.s.RepoFilter  :222) - Sending HTTP error code 404: Failed to read stream: null

I have noticed similar behaviour with Nexus. I also get the same error if I try and upload the jar using Artifactory UI. Funny enough if I extract the jar file using:

jar xf demo.jar

and then zip it back again changing the flague changing the flague to "cf" then this newly packaged jar can successfully be uploaded to Artifactory. It seems like Maven is doing something funny with the jar at the build step. Does anyony have any idea what I could be doing wrong? Having to extract and repackage the jar before deploying it is far from ideal, especially that I would like to do it for a number of projects automatically with Jenkins.

Below is the entire not working pom.xml:

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <artifactId>artifactory-demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>artifactory-demo</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-zipkin</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jfrog.artifactory.client</groupId>
            <artifactId>artifactory-java-client-services</artifactId>
            <version>LATEST</version>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Dalston.M1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <distributionManagement>
        <snapshotRepository>
            <id>snapshots</id>
            <name>snapshots</name>
            <url>http://artifactory.server.ip:8079/artifactory/snapshot-local</url>
        </snapshotRepository>
    </distributionManagement>
</project>
1
Can be caused by a global JAR file size. What is the size (in MB) of your JAR that you cannot upload?Tome
It's 31MB, but as I say: if I extract the jar and compress it back again, size stays the same, but then upload completes successfully. I have also tried adding large random text files to jar and uploading these. That works fine as well, so I don't think size is the issue.user3681304

1 Answers

0
votes

It turned out to be a weird issue with our on-premise infrastructure. The server was simply dropping the connection, so I temporarily put my Nexus on the same machine as our CI application