使用Jenkins管道脚本将工件发布到Artifactory时出错

时间:2017-12-05 14:02:28

标签: maven jenkins-pipeline artifactory

我正在尝试

我正在使用Artifactory maven构建一个应用程序,并将生成的工件发布到Artifactory服务器。

我需要什么

如果有任何建议,我很乐意立即尝试。 ;)

Jenkins管道脚本

 
 stage ('Build and Deploy Artifacts') {      
    def server = Artifactory.newServer url: 'http://****/home', credentialsId: 'd***5c1'    
    def rtMaven = Artifactory.newMavenBuild()    
    rtMaven.resolver releaseRepo:'libs-release', snapshotRepo:'libs-snapshot', server: server    
    rtMaven.deployer releaseRepo:'develop-release', snapshotRepo:'develop-snapshot', server: server    
    rtMaven.tool = 'maven' // Tool name from Jenkins configuration    
    def buildInfo = rtMaven.run pom: 'pom.xml', goals: 'clean install -Dmaven.test.skip=true' //buildInfo: buildInfo'     
    buildInfo.env.capture = true    
    server.publishBuildInfo buildInfo     
}   

Jenkins

上显示的错误
Started by user Sunil boga
    [Pipeline] node
    Running on master in /var/lib/jenkins/workspace/JF
            [Pipeline] {
            [Pipeline] stage
            [Pipeline] { (Checkout)
            [Pipeline] checkout
     > git rev-parse --is-inside-work-tree # timeout=10
    Fetching changes from the remote Git repository
     > git config remote.origin.url https:***.git # timeout=10
    Fetching upstream changes from https:***.git
     > git --version # timeout=10
     > git fetch --tags --progress https:***.git +refs/heads/*:refs/remotes/origin/*
     > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
     > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
    Checking out Revision a704ec6ba9b9af8a1a02aeb3d1041a15135ac3d4 (refs/remotes/origin/master)
    Commit message: "Update docker-compose.yml"
     > git config core.sparsecheckout # timeout=10
     > git checkout -f a704ec6ba9b9af8a1a02aeb3d1041a15135ac3d4
     > git rev-list a704ec6ba9b9af8a1a02aeb3d1041a15135ac3d4 # timeout=10
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] stage
    [Pipeline] { (Build and Deploy Artifacts)
    [Pipeline] newArtifactoryServer
    [Pipeline] newMavenBuild
    [Pipeline] ArtifactoryMavenBuild
    Jenkins Artifactory Plugin version: 2.13.0
    Artifactory integration is enabled

[JF] $ java -classpath /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven/boot/* -Dmaven.home=/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven -DbuildInfoConfig.propertiesFile=/var/lib/jenkins/workspace/JF@tmp/buildInfo7470386380438368064.properties -Dm3plugin.lib=/var/lib/jenkins/workspace/JF@tmp/cache/artifactory-plugin/2.13.0 -Dclassworlds.conf=/var/lib/jenkins/workspace/JF@tmp/classworlds7388179377818037761conf -Dmaven.multiModuleProjectDirectory=/var/lib/jenkins/workspace/JF org.codehaus.plexus.classworlds.launcher.Launcher -f pom.xml clean install -Dmaven.test.skip=true
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Scanning for projects...
    [main] INFO org.jfrog.build.extractor.maven.BuildInfoRecorder - Initializing Artifactory Build-Info Recording
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Building SampleProjectForCICD 0.0.1-SNAPSHOT
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
    [main] WARNING org.codehaus.plexus.PlexusContainer - The POM for com.oracle.jdbc:ojdbc8:jar:12.2.0.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-clean-plugin:2.6.1:clean (default-clean) @ sampleproject ---
    [main] INFO org.apache.maven.plugin.clean.CleanMojo - Deleting /var/lib/jenkins/workspace/JF/target
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-resources-plugin:2.6:resources (default-resources) @ sampleproject ---
    [main] INFO org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering - Using 'UTF-8' encoding to copy filtered resources.
    [main] INFO org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering - Copying 1 resource
    [main] INFO org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering - Copying 3 resources
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-compiler-plugin:3.1:compile (default-compile) @ sampleproject ---
    [main] INFO org.apache.maven.plugin.compiler.CompilerMojo - Changes detected - recompiling the module!
    [main] INFO org.codehaus.plexus.compiler.javac.JavacCompiler - Compiling 11 source files to /var/lib/jenkins/workspace/JF/target/classes
    [main] WARNING org.apache.maven.plugin.compiler.CompilerMojo - /var/lib/jenkins/workspace/JF/src/main/java/guru/springframework/controllers/ProductAPI.java: /var/lib/jenkins/workspace/JF/src/main/java/guru/springframework/controllers/ProductAPI.java uses unchecked or unsafe operations.
    [main] WARNING org.apache.maven.plugin.compiler.CompilerMojo - /var/lib/jenkins/workspace/JF/src/main/java/guru/springframework/controllers/ProductAPI.java: Recompile with -Xlint:unchecked for details.
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-resources-plugin:2.6:testResources (default-testResources) @ sampleproject ---
    [main] INFO org.apache.maven.plugin.resources.TestResourcesMojo - Not copying test resources
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ sampleproject ---
    [main] INFO org.apache.maven.plugin.compiler.TestCompilerMojo - Not compiling test sources
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-surefire-plugin:2.18.1:test (default-test) @ sampleproject ---
    [main] INFO org.apache.maven.plugin.surefire.SurefirePlugin - Tests are skipped.
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-jar-plugin:2.6:jar (default-jar) @ sampleproject ---
    [main] INFO org.codehaus.plexus.archiver.jar.JarArchiver - Building jar: /var/lib/jenkins/workspace/JF/target/sampleproject-0.0.1-SNAPSHOT.jar
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- spring-boot-maven-plugin:1.5.1.RELEASE:repackage (default) @ sampleproject ---
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - 
    [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-install-plugin:2.5.2:install (default-install) @ sampleproject ---
    [main] INFO org.codehaus.plexus.PlexusContainer - Installing /var/lib/jenkins/workspace/JF/target/sampleproject-0.0.1-SNAPSHOT.jar to /var/lib/jenkins/.m2/repository/com/fortna/cicd/sampleproject/0.0.1-SNAPSHOT/sampleproject-0.0.1-SNAPSHOT.jar
    [main] INFO org.codehaus.plexus.PlexusContainer - Installing /var/lib/jenkins/workspace/JF/pom.xml to /var/lib/jenkins/.m2/repository/com/fortna/cicd/sampleproject/0.0.1-SNAPSHOT/sampleproject-0.0.1-SNAPSHOT.pom
    [main] INFO org.jfrog.build.extractor.maven.BuildInfoClientBuilder - Deploying artifact: http://***:8081/artifactory/webapp/#/home/develop-snapshot/com/fortna/cicd/sampleproject/0.0.1-SNAPSHOT/sampleproject-0.0.1-SNAPSHOT.jar
    [main] WARNING org.jfrog.build.extractor.maven.BuildInfoClientBuilder - Error occurred for request PUT /artifactory/webapp/%23/home/develop-snapshot/com/fortna/cicd/sampleproject/0.0.1-SNAPSHOT/sampleproject-0.0.1-SNAPSHOT.jar;vcs.revision=a704ec6ba9b9af8a1a02aeb3d1041a15135ac3d4;build.timestamp=1512480424292;build.name=JF;build.number=19 HTTP/1.1: Connection reset.
    [main] WARNING org.jfrog.build.extractor.maven.BuildInfoClientBuilder - Attempting retry #1
    [main] INFO org.apache.http.impl.execchain.RetryExec - I/O exception (java.net.SocketException) caught when processing request to {}->http://***:8081: Connection reset
    [main] INFO org.apache.http.impl.execchain.RetryExec - Retrying request to {}->http://***:8081
    [main] WARNING org.jfrog.build.extractor.maven.BuildInfoClientBuilder - Error occurred for request PUT /artifactory/webapp/%23/home/develop-snapshot/com/fortna/cicd/sampleproject/0.0.1-SNAPSHOT/sampleproject-0.0.1-SNAPSHOT.jar;vcs.revision=a704ec6ba9b9af8a1a02aeb3d1041a15135ac3d4;build.timestamp=1512480424292;build.name=JF;build.number=19 HTTP/1.1: Connection reset.
    [main] WARNING org.jfrog.build.extractor.maven.BuildInfoClientBuilder - Attempting retry #2
    [main] INFO org.apache.http.impl.execchain.RetryExec - I/O exception (java.net.SocketException) caught when processing request to {}->http://***:8081: Connection reset
    [main] INFO org.apache.http.impl.execchain.RetryExec - Retrying request to {}->http://***:8081
    [main] WARNING org.jfrog.build.extractor.maven.BuildInfoClientBuilder - Error occurred for request PUT /artifactory/webapp/%23/home/develop-snapshot/com/fortna/cicd/sampleproject/0.0.1-SNAPSHOT/sampleproject-0.0.1-SNAPSHOT.jar;vcs.revision=a704ec6ba9b9af8a1a02aeb3d1041a15135ac3d4;build.timestamp=1512480424292;build.name=JF;build.number=19 HTTP/1.1: Connection reset.
    [main] WARNING org.jfrog.build.extractor.maven.BuildInfoClientBuilder - Attempting retry #3
    [main] INFO org.apache.http.impl.execchain.RetryExec - I/O exception (java.net.SocketException) caught when processing request to {}->http://***:8081: Connection reset
    [main] INFO org.apache.http.impl.execchain.RetryExec - Retrying request to {}->http://***:8081
    [main] WARNING org.jfrog.build.extractor.maven.BuildInfoClientBuilder - Error occurred for request PUT /artifactory/webapp/%23/home/develop-snapshot/com/fortna/cicd/sampleproject/0.0.1-SNAPSHOT/sampleproject-0.0.1-SNAPSHOT.jar;vcs.revision=a704ec6ba9b9af8a1a02aeb3d1041a15135ac3d4;build.timestamp=1512480424292;build.name=JF;build.number=19 HTTP/1.1: Connection reset.
    [main] ERROR org.jfrog.build.extractor.maven.BuildInfoRecorder - org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded() listener has failed: 
    java.lang.RuntimeException: Error occurred while publishing artifact to Artifactory: /var/lib/jenkins/workspace/JF/target/sampleproject-0.0.1-SNAPSHOT.jar.
     Skipping deployment of remaining artifacts (if any) and build info.
        at org.jfrog.build.extractor.maven.BuildDeploymentHelper.deployArtifacts (BuildDeploymentHelper.java:296)
        at org.jfrog.build.extractor.maven.BuildDeploymentHelper.deploy (BuildDeploymentHelper.java:117)
        at org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded (BuildInfoRecorder.java:173)
        at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire (DefaultExecutionEventCatapult.java:64)
        at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire (DefaultExecutionEventCatapult.java:42)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:137)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
        at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
        at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
        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: java.net.SocketException: Connection reset
        at java.net.SocketOutputStream.socketWrite (SocketOutputStream.java:115)
        at java.net.SocketOutputStream.write (SocketOutputStream.java:155)
        at org.apache.http.impl.io.SessionOutputBufferImpl.streamWrite (SessionOutputBufferImpl.java:124)
        at org.apache.http.impl.io.SessionOutputBufferImpl.flushBuffer (SessionOutputBufferImpl.java:136)
        at org.apache.http.impl.io.SessionOutputBufferImpl.write (SessionOutputBufferImpl.java:167)
        at org.apache.http.impl.io.ContentLengthOutputStream.write (ContentLengthOutputStream.java:113)
        at org.apache.http.entity.FileEntity.writeTo (FileEntity.java:99)
        at org.apache.http.impl.DefaultBHttpClientConnection.sendRequestEntity (DefaultBHttpClientConnection.java:156)
        at org.apache.http.impl.conn.CPoolProxy.sendRequestEntity (CPoolProxy.java:162)
        at org.apache.http.protocol.HttpRequestExecutor.doSendRequest (HttpRequestExecutor.java:238)
        at org.apache.http.protocol.HttpRequestExecutor.execute (HttpRequestExecutor.java:123)
        at org.apache.http.impl.execchain.MainClientExec.execute (MainClientExec.java:271)
        at org.apache.http.impl.execchain.ProtocolExec.execute (ProtocolExec.java:184)
        at org.apache.http.impl.execchain.RetryExec.execute (RetryExec.java:88)
        at org.apache.http.impl.execchain.RedirectExec.execute (RedirectExec.java:110)
        at org.apache.http.impl.execchain.ServiceUnavailableRetryExec.execute (ServiceUnavailableRetryExec.java:84)
        at org.apache.http.impl.client.InternalHttpClient.doExecute (InternalHttpClient.java:184)
        at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:82)
        at org.jfrog.build.client.PreemptiveHttpClient.execute (PreemptiveHttpClient.java:103)
        at org.jfrog.build.client.ArtifactoryHttpClient.execute (ArtifactoryHttpClient.java:216)
        at org.jfrog.build.client.ArtifactoryHttpClient.upload (ArtifactoryHttpClient.java:212)
        at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.uploadFile (ArtifactoryBuildInfoClient.java:654)
        at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.deployArtifact (ArtifactoryBuildInfoClient.java:344)
        at org.jfrog.build.extractor.maven.BuildDeploymentHelper.deployArtifacts (BuildDeploymentHelper.java:294)
        at org.jfrog.build.extractor.maven.BuildDeploymentHelper.deploy (BuildDeploymentHelper.java:117)
        at org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded (BuildInfoRecorder.java:173)
        at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire (DefaultExecutionEventCatapult.java:64)
        at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire (DefaultExecutionEventCatapult.java:42)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:137)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
        at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
        at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
        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)
    [main] ERROR org.apache.maven.cli.MavenCli - Internal error: java.lang.RuntimeException: org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded() listener has failed: Error occurred while publishing artifact to Artifactory: /var/lib/jenkins/workspace/JF/target/sampleproject-0.0.1-SNAPSHOT.jar.
    [main] ERROR org.apache.maven.cli.MavenCli -  Skipping deployment of remaining artifacts (if any) and build info. Connection reset
    [main] ERROR org.apache.maven.cli.MavenCli - -> [Help 1]
    org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded() listener has failed: 
        at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:122)
        at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
        at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
        at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
        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: java.lang.RuntimeException: org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded() listener has failed: 
        at org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded (BuildInfoRecorder.java:182)
        at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire (DefaultExecutionEventCatapult.java:64)
        at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire (DefaultExecutionEventCatapult.java:42)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:137)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
        at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
        at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
        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: java.lang.RuntimeException: Error occurred while publishing artifact to Artifactory: /var/lib/jenkins/workspace/JF/target/sampleproject-0.0.1-SNAPSHOT.jar.
     Skipping deployment of remaining artifacts (if any) and build info.
        at org.jfrog.build.extractor.maven.BuildDeploymentHelper.deployArtifacts (BuildDeploymentHelper.java:296)
        at org.jfrog.build.extractor.maven.BuildDeploymentHelper.deploy (BuildDeploymentHelper.java:117)
        at org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded (BuildInfoRecorder.java:173)
        at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire (DefaultExecutionEventCatapult.java:64)
        at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire (DefaultExecutionEventCatapult.java:42)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:137)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
        at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
        at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
        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: java.net.SocketException: Connection reset
        at java.net.SocketOutputStream.socketWrite (SocketOutputStream.java:115)
        at java.net.SocketOutputStream.write (SocketOutputStream.java:155)
        at org.apache.http.impl.io.SessionOutputBufferImpl.streamWrite (SessionOutputBufferImpl.java:124)
        at org.apache.http.impl.io.SessionOutputBufferImpl.flushBuffer (SessionOutputBufferImpl.java:136)
        at org.apache.http.impl.io.SessionOutputBufferImpl.write (SessionOutputBufferImpl.java:167)
        at org.apache.http.impl.io.ContentLengthOutputStream.write (ContentLengthOutputStream.java:113)
        at org.apache.http.entity.FileEntity.writeTo (FileEntity.java:99)
        at org.apache.http.impl.DefaultBHttpClientConnection.sendRequestEntity (DefaultBHttpClientConnection.java:156)
        at org.apache.http.impl.conn.CPoolProxy.sendRequestEntity (CPoolProxy.java:162)
        at org.apache.http.protocol.HttpRequestExecutor.doSendRequest (HttpRequestExecutor.java:238)
        at org.apache.http.protocol.HttpRequestExecutor.execute (HttpRequestExecutor.java:123)
        at org.apache.http.impl.execchain.MainClientExec.execute (MainClientExec.java:271)
        at org.apache.http.impl.execchain.ProtocolExec.execute (ProtocolExec.java:184)
        at org.apache.http.impl.execchain.RetryExec.execute (RetryExec.java:88)
        at org.apache.http.impl.execchain.RedirectExec.execute (RedirectExec.java:110)
        at org.apache.http.impl.execchain.ServiceUnavailableRetryExec.execute (ServiceUnavailableRetryExec.java:84)
        at org.apache.http.impl.client.InternalHttpClient.doExecute (InternalHttpClient.java:184)
        at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:82)
        at org.jfrog.build.client.PreemptiveHttpClient.execute (PreemptiveHttpClient.java:103)
        at org.jfrog.build.client.ArtifactoryHttpClient.execute (ArtifactoryHttpClient.java:216)
        at org.jfrog.build.client.ArtifactoryHttpClient.upload (ArtifactoryHttpClient.java:212)
        at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.uploadFile (ArtifactoryBuildInfoClient.java:654)
        at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.deployArtifact (ArtifactoryBuildInfoClient.java:344)
        at org.jfrog.build.extractor.maven.BuildDeploymentHelper.deployArtifacts (BuildDeploymentHelper.java:294)
        at org.jfrog.build.extractor.maven.BuildDeploymentHelper.deploy (BuildDeploymentHelper.java:117)
        at org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded (BuildInfoRecorder.java:173)
        at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire (DefaultExecutionEventCatapult.java:64)
        at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire (DefaultExecutionEventCatapult.java:42)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:137)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
        at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
        at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
        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)
    [main] ERROR org.apache.maven.cli.MavenCli - 
    [main] ERROR org.apache.maven.cli.MavenCli - To see the full stack trace of the errors, re-run Maven with the -e switch.
    [main] ERROR org.apache.maven.cli.MavenCli - Re-run Maven using the -X switch to enable full debug logging.
    [main] ERROR org.apache.maven.cli.MavenCli - 
    [main] ERROR org.apache.maven.cli.MavenCli - For more information about the errors and possible solutions, please read the following articles:
    [main] ERROR org.apache.maven.cli.MavenCli - [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/InternalErrorException
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] }
    [Pipeline] // node
    [Pipeline] End of Pipeline
    java.lang.RuntimeException: Maven build failed
        at org.jfrog.hudson.pipeline.steps.ArtifactoryMavenBuild$Execution.run(ArtifactoryMavenBuild.java:108)
        at org.jfrog.hudson.pipeline.steps.ArtifactoryMavenBuild$Execution.run(ArtifactoryMavenBuild.java:61)
        at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
        at hudson.security.ACL.impersonate(ACL.java:260)
        at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
    Finished: FAILURE

2 个答案:

答案 0 :(得分:0)

部署工件

stage ('Deploy Artifacts') {

    //Artifactory server instance declaration   
    def server = Artifactory.server 'server1' //server1 is the Server ID given to Artifactory server in Jenkins

    //Capturing the Build artifacts from Build server to upload
    def uploadSpec = """{
        "files": [
            {
                "pattern": "/var/lib/jenkins/workspace/JF/target/*.jar",
                "target": "fortna_sample/"
            }
        ]
    }"""
    server.upload(uploadSpec)

    //Capturing the artifacts from Artifactory server to download it into Jenkins machine at /var/lib/jenkins/workspace/JF/jarFile/
    def downloadSpec = """{
        "files": [
            {
                "pattern": "fortna_sample/sampleproject-0.0.1-SNAPSHOT.jar",
                "target": "jarFile/" 
            }
        ]
    }"""
    server.download(downloadSpec)


    //Publishing build info to Artifactory - Method 2
    def buildInfo = Artifactory.newBuildInfo()
    server.upload spec: uploadSpec, buildInfo: buildInfo
    //server.download spec: downloadSpec, buildInfo: buildInfo
    server.publishBuildInfo buildInfo

    //Capturing Environment variables
    buildInfo.env.capture = true
    buildInfo.env.collect()
    buildInfo.retention maxBuilds: 10, maxDays: 7, deleteBuildArtifacts: true

    // Build Promotion Section
    def promotionConfig = [
        // Mandatory parameters
        'buildName'          : buildInfo.name,
        'buildNumber'        : buildInfo.number,
        'targetRepo'         : 'libs-release-local',

        // Optional parameters
        'comment'            : 'PROMOTION SUCCESSFULLY COMPLETED',
        'sourceRepo'         : 'fortna_sample',
        'status'             : 'Released',
        'includeDependencies': false,
        'copy'               : false,
        // 'failFast' is true by default.
        // Set it to false, if you don't want the promotion to abort upon receiving the first error.
        'failFast'           : true
    ]

    // Promote build
    //server.promote promotionConfig //this promotes the build automatically to the target specified in promotionConfig 
    Artifactory.addInteractivePromotion server: server, promotionConfig: promotionConfig, displayName: "Promotions Time" //this need human interaction to promote
    echo "Build Completed Successfully and Promotions are manual"
}

答案 1 :(得分:0)

[错误] org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded()侦听器失败: [错误]跳过剩余工件(如果有)和构建信息的部署。连接重置 [错误]-> [帮助1]

解决方案:

如果由于上述原因导致作业失败,那么我们需要取消选中-将密码作为构建环境中的环境变量注入到构建中的-掩码密码参数(用户名和密码)。

然后重新运行作业。