无法将jar从Spring Boot应用程序部署到Nexus / Artifactory

时间:2017-02-07 14:02:53

标签: maven spring-boot nexus spring-cloud artifactory

使用maven部署到我的本地artifactory / nexus适用于示例Spring Boot应用程序(在start.spring.io上生成):

mvn clean package deploy

但是,只要我将org.springframweork.cloud中的依赖项添加到我的pom中:

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

然后部署失败,并且#34;连接重置&#34;在客户端。 artifactory.log显示

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

我注意到与Nexus类似的行为。如果我尝试使用Artifactory UI上传jar,我也会得到同样的错误。如果我使用以下方法提取jar文件,那就很有趣了。

jar xf demo.jar

然后再将其拉回来更改标志,将标志更改为&#34; cf&#34;然后这个新包装的jar可以成功上传到Artifactory。看起来Maven在构建步骤中使用jar做了一些有趣的事情。 anyony知道我可能做错了什么吗?在部署之前必须提取并重新打包jar远非理想,特别是我想用Jenkins自动完成许多项目。

以下是整个无效的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 个答案:

答案 0 :(得分:0)

事实证明,我们的内部部署基础架构是一个奇怪的问题。服务器只是放弃连接,所以我暂时将我的Nexus放在与CI应用程序相同的机器上