From 9c9c66f745a66ebd9b3bd0cbf44fb3f3ec4b6393 Mon Sep 17 00:00:00 2001 From: VSAzima Date: Fri, 23 Apr 2021 13:55:29 +0400 Subject: [PATCH] sample --- Jenkinsfile | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e1f67cc74..7b8f6063f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,27 +50,28 @@ pipeline { // } stage('push') { steps { - script { - pom = readMavenPom file: "pom.xml"; - filesByGlob = findFiles(glob: "target/*.${pom.packaging}"); - echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}" - artifactPath = filesByGlob[0].path; - artifactExists = fileExists artifactPath; - // - // if(artifactExists) { - // echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; - - nexusArtifactUploader nexusVersion: "${env.NEXUS_VERSION}", protocol: "${env.NEXUS_PROTOCOL}", nexusUrl: "${env.NEXUS_URL}", groupId: pom.groupId, version: pom.version, repository: "${env.NEXUS_REPOSITORY}", credentialsId: "${env.NEXUS_CREDENTIAL_ID}", artifacts: [ - [artifactId: pom.artifactId, - classifier: '', - file: artifactPath, - type: pom.packaging], - [artifactId: pom.artifactId, - classifier: '', - file: "pom.xml", - type: "pom"] - ] - ; + nexusPublisher nexusInstanceId: 'maven-nexus-repo', nexusRepositoryId: 'maven-releases', packages: [[$class: 'MavenPackage', mavenAssetList: [[classifier: '', extension: '.jar', filePath: '/target/']], mavenCoordinate: [artifactId: 'spring-petclinic', groupId: 'org.springframework.samples', packaging: 'pom', version: '2.4.2']]] + // script { + // pom = readMavenPom file: "pom.xml"; + // filesByGlob = findFiles(glob: "target/*.${pom.packaging}"); + // echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}" + // artifactPath = filesByGlob[0].path; + // artifactExists = fileExists artifactPath; + // // + // // if(artifactExists) { + // // echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; + // + // nexusArtifactUploader nexusVersion: "${env.NEXUS_VERSION}", protocol: "${env.NEXUS_PROTOCOL}", nexusUrl: "${env.NEXUS_URL}", groupId: pom.groupId, version: pom.version, repository: "${env.NEXUS_REPOSITORY}", credentialsId: "${env.NEXUS_CREDENTIAL_ID}", artifacts: [ + // [artifactId: pom.artifactId, + // classifier: '', + // file: artifactPath, + // type: pom.packaging], + // [artifactId: pom.artifactId, + // classifier: '', + // file: "pom.xml", + // type: "pom"] + // ] + // ; } // } else {