maven nexus-staging-maven-plugin exception-connect timed out

不知道是国内的网络的问题还是别的原因,在deploy一个maven的artifact到oss server的时候总是报错:

Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.7:deploy (injected-nexus-deploy) on project becauseQA-utils: Remote staging failed: Failed to deploy artifacts: Could not transfer artifact com.github.becauseQA:becauseQA-utils:jar:sources:1.0.1 from/to nexus (https://oss.sonatype.org:443/service/local/staging/deployByRepositoryId/comgithubbecauseqa-1023): connect timed out -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.7:deploy (injected-nexus-deploy) on project becauseQA-utils: Remote staging failed: Failed to deploy artifacts: Could not transfer artifact com.github.becauseQA:becauseQA-utils:jar:sources:1.0.1 from/to nexus (https://oss.sonatype.org:443/service/local/staging/deployByRepositoryId/comgithubbecauseqa-1023): connect timed out
	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: Remote staging failed: Failed to deploy artifacts: Could not transfer artifact com.github.becauseQA:becauseQA-utils:jar:sources:1.0.1 from/to nexus (https://oss.sonatype.org:443/service/local/staging/deployByRepositoryId/comgithubbecauseqa-1023): connect timed out
	at org.sonatype.nexus.maven.staging.deploy.DeployMojo.execute(DeployMojo.java:216)
	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: Remote staging failed: Failed to deploy artifacts: Could not transfer artifact com.github.becauseQA:becauseQA-utils:jar:sources:1.0.1 from/to nexus (https://oss.sonatype.org:443/service/local/staging/deployByRepositoryId/comgithubbecauseqa-1023): connect timed out
	at org.sonatype.nexus.maven.staging.deploy.strategy.StagingDeployStrategy.finalizeDeploy(StagingDeployStrategy.java:155)
	at org.sonatype.nexus.maven.staging.deploy.DeployMojo.execute(DeployMojo.java:213)
	... 22 more
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to deploy artifacts: Could not transfer artifact com.github.becauseQA:becauseQA-utils:jar:sources:1.0.1 from/to nexus (https://oss.sonatype.org:443/service/local/staging/deployByRepositoryId/comgithubbecauseqa-1023): connect timed out
	at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:143)
	at org.sonatype.nexus.maven.staging.deploy.strategy.AbstractDeployStrategy.deployUp(AbstractDeployStrategy.java:213)
	at org.sonatype.nexus.maven.staging.deploy.strategy.StagingDeployStrategy.finalizeDeploy(StagingDeployStrategy.java:125)
	... 23 more
Caused by: org.eclipse.aether.deployment.DeploymentException: Failed to deploy artifacts: Could not transfer artifact com.github.becauseQA:becauseQA-utils:jar:sources:1.0.1 from/to nexus (https://oss.sonatype.org:443/service/local/staging/deployByRepositoryId/comgithubbecauseqa-1023): connect timed out
	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.github.becauseQA:becauseQA-utils:jar:sources:1.0.1 from/to nexus (https://oss.sonatype.org:443/service/local/staging/deployByRepositoryId/comgithubbecauseqa-1023): connect timed out
	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.SocketTimeoutException: connect timed out
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at com.squareup.okhttp.internal.Platform.connectSocket(Platform.java:100)
	at com.squareup.okhttp.Connection.connectSocket(Connection.java:196)
	at com.squareup.okhttp.Connection.connect(Connection.java:172)
	at com.squareup.okhttp.Connection.connectAndSetOwner(Connection.java:367)
	at com.squareup.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:128)
	at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:328)
	at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:245)
	at com.squareup.okhttp.Call.getResponse(Call.java:267)
	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
[DEBUG] Connection manager is shutting down

反复尝试了多次还是报错,实在没有办法了,我只能通过代理上网然后手动进行发布,操作步骤如下:

  1. 进入sonatype管理网站,https://oss.sonatype.org/#stagingRepositories ,前提是你记得注册他们的账号,具体如何操作,请google之。
  2. 在左边的导航栏中点击 “Staging Upload”,进入如下页面:

maven nexus-staging-maven-plugin exception-connect timed out_第1张图片

3.  最重要的一步就是这里了,这里我们上传的所有的文件目录一定要是你使用maven 插件nexus-staging-maven-plugin 生成的staging目录,例如我的工程师becauseQA,那么目录就是: becauseQA-utils\target\nexus-staging\staging\104a5d5a8fd342\com\github\becauseQA

3.1 Upload Mode选择 “Artifact with a Pom”,点击“Select POM to Upload” 进入上面的staging目录选择对应的pom文件;

3.2 点击“Select Artifact(s) for Upload” 按钮还是进入刚才的staging目录,选择对应的jar文件点击“Add Artifacts”按钮,重复该步骤上传该目录下所有的jar文件包括doc和source文件,还有一些用gpg生成的asc文件,例如这里对应的所有需要上传的文件清单如下:

maven nexus-staging-maven-plugin exception-connect timed out_第2张图片

完成所有的设置后,点击“Upload Artifacts”按钮等待片刻上传即可成功。

 

实在是没有办法,国内的网络被blocked的太多了,只能尝试代理上网下手工方式进行发布了。

 

另附对应的nexus-staging-maven-plugin插件的配置信息


						org.sonatype.plugins
						nexus-staging-maven-plugin
						${nexus-staging-maven-plugin.version}
						true

						
							nexus
							https://oss.sonatype.org/
							false
							true
							20
							20
							true
						
					

你可能感兴趣的:(maven nexus-staging-maven-plugin exception-connect timed out)