部署到nexus时意外结束流异常

时间:2018-01-03 14:57:51

标签: maven nexus

我需要将快照jar部署到远程nexus存储库(Nexus OSS 3.7.1-02)。 服务器和存储库详细信息将添加到settings.xml中,并在pom.xml中添加distributionManagement。

部署在localhost上的nexus存储库上运行正常。但是在远程存储库中,只部署了pom,md5和sha1,并且jar部署失败,并显示错误“意外的流结束”。感谢任何帮助解决这个问题。

nexus repository screenshot

完整的堆栈跟踪如下:

    Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project api-core: Failed to deploy artifacts: Could not transfer artifact com.proj.api:api-core:jar:0.0.1-20180103.144552-1 from/to proj-repository (http://<nexus_url>/nexus/repository/proj-snapshots): unexpected end of stream -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project api-core: Failed to deploy artifacts: Could not transfer artifact com.proj.api:api-core:jar:0.0.1-20180103.144552-1 from/to proj-repository (http://<nexus_url>/nexus/repository/proj-snapshots): unexpected end of stream
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to deploy artifacts: Could not transfer artifact com.proj.api:api-core:jar:0.0.1-20180103.144552-1 from/to proj-repository (http://<nexus_url>/nexus/repository/proj-snapshots): unexpected end of stream
    at org.apache.maven.plugin.deploy.DeployMojo.deployProject(DeployMojo.java:284)
    at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:169)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 20 more
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to deploy artifacts: Could not transfer artifact com.proj.api:api-core:jar:0.0.1-20180103.144552-1 from/to proj-repository (http://<nexus_url>/nexus/repository/proj-snapshots): unexpected end of stream
    at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:143)
    at org.apache.maven.plugin.deploy.AbstractDeployMojo.deploy(AbstractDeployMojo.java:171)
    at org.apache.maven.plugin.deploy.DeployMojo.deployProject(DeployMojo.java:250)
    ... 23 more
Caused by: org.eclipse.aether.deployment.DeploymentException: Failed to deploy artifacts: Could not transfer artifact com.proj.api:api-core:jar:0.0.1-20180103.144552-1 from/to proj-repository (http://<nexus_url>/nexus/repository/proj-snapshots): unexpected end of stream
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:317)
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:245)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:413)
    at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:139)
    ... 25 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact com.proj.api:api-core:jar:0.0.1-20180103.144552-1 from/to proj-repository (http://<nexus_url>/nexus/repository/proj-snapshots): unexpected end of stream
    at io.takari.aether.connector.AetherRepositoryConnector$2.wrap(AetherRepositoryConnector.java:895)
    at io.takari.aether.connector.AetherRepositoryConnector$2.wrap(AetherRepositoryConnector.java:1)
    at io.takari.aether.connector.AetherRepositoryConnector$PutTask.flush(AetherRepositoryConnector.java:743)
    at io.takari.aether.connector.AetherRepositoryConnector.put(AetherRepositoryConnector.java:345)
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:311)
    ... 28 more
Caused by: java.net.ProtocolException: unexpected end of stream
    at com.squareup.okhttp.internal.http.HttpConnection$FixedLengthSink.close(HttpConnection.java:314)
    at okio.RealBufferedSink.close(RealBufferedSink.java:241)
    at okio.RealBufferedSink$1.close(RealBufferedSink.java:209)
    at com.google.common.io.Closer.close(Closer.java:214)
    at io.takari.aether.connector.AetherRepositoryConnector$FileSource.copyTo(AetherRepositoryConnector.java:147)
    at io.takari.aether.okhttp.OkHttpAetherClient$2.writeTo(OkHttpAetherClient.java:141)
    at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:887)
    at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:749)
    at com.squareup.okhttp.Call.getResponse(Call.java:268)
    at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:224)
    at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:195)
    at com.squareup.okhttp.Call.execute(Call.java:79)
    at io.takari.aether.okhttp.OkHttpAetherClient.execute(OkHttpAetherClient.java:167)
    at io.takari.aether.okhttp.OkHttpAetherClient.put(OkHttpAetherClient.java:161)
    at io.takari.aether.connector.AetherRepositoryConnector$PutTask.run(AetherRepositoryConnector.java:715)
    at io.takari.aether.connector.AetherRepositoryConnector.put(AetherRepositoryConnector.java:332)
    ... 29 more

1 个答案:

答案 0 :(得分:0)

谢谢khmarbaise指点。 原来,nexus在前面有一个代理,这限制了可以上传的罐子的大小。 这是一个弹簧靴应用程序,创建一个胖罐。因此失败了。

显然,当我运行本地托管的nexus并且无法从异常堆栈跟踪中解密时,我没有遇到这个问题。

在更改代理中的大小限制后,此问题现已恢复。