Skip to content

Instantly share code, notes, and snippets.

@robertobatts
Last active April 22, 2021 03:51
Show Gist options
  • Select an option

  • Save robertobatts/42da9069e13b61a238f51c36754de97b to your computer and use it in GitHub Desktop.

Select an option

Save robertobatts/42da9069e13b61a238f51c36754de97b to your computer and use it in GitHub Desktop.

Revisions

  1. robertobatts revised this gist Dec 17, 2019. 1 changed file with 1 addition and 5 deletions.
    6 changes: 1 addition & 5 deletions JenkinsfileMavenArtifactory.groovy
    Original file line number Diff line number Diff line change
    @@ -23,9 +23,6 @@ pipeline {
    releaseRepo: "libs-release",
    snapshotRepo: "libs-release"
    )
    //with the resolver it doesn't work, I suppose it's because Artifactory doesn't support Maven3
    //I'll manage the resolver by changing the settings.xml
    /*rtMavenResolver(id:"MAVEN_RESOLVER",serverId:"server_tutorial",releaseRepo:"libs-release",snapshotRepo:"libs-release")*/
    }
    }

    @@ -37,8 +34,7 @@ pipeline {
    tool: "Maven 3.6.2",//Tool name from Jenkins configuration
    pom: 'pom.xml',
    goals: '-U -s $MAVEN_SETTINGS_XML clean install',
    deployerId: "MAVEN_DEPLOYER"/*,
    resolverId: "MAVEN_RESOLVER"*/
    deployerId: "MAVEN_DEPLOYER"
    )
    }
    }
  2. robertobatts renamed this gist Nov 18, 2019. 1 changed file with 0 additions and 0 deletions.
  3. robertobatts revised this gist Nov 18, 2019. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions JenkinsfileMavenArtifactory
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,10 @@
    pipeline {
    agent any

    triggers {
    bitbucketPush()
    }

    tools {
    jdk 'OpenJDK_1_8_0'
    }
  4. robertobatts revised this gist Nov 17, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions JenkinsfileMavenArtifactory
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    pipeline{
    pipeline {
    agent any

    tools {
    @@ -30,7 +30,7 @@ pipeline{
    configFileProvider([configFile(fileId: 'MavenArtifactorySettingId', variable: 'MAVEN_SETTINGS_XML')]) {
    retry(count: 3) {
    rtMavenRun(
    tool: "Maven3.6.2",//Tool name from Jenkins configuration
    tool: "Maven 3.6.2",//Tool name from Jenkins configuration
    pom: 'pom.xml',
    goals: '-U -s $MAVEN_SETTINGS_XML clean install',
    deployerId: "MAVEN_DEPLOYER"/*,
  5. robertobatts revised this gist Nov 17, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion JenkinsfileMavenArtifactory
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ pipeline{

    stages {
    stage('Artifactory config') {
    steps{
    steps {
    rtServer(
    id: "server_tutorial",
    url: "http://3.134.8.172:8081/artifactory",
  6. robertobatts revised this gist Nov 17, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion JenkinsfileMavenArtifactory
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@ pipeline{
    snapshotRepo: "libs-release"
    )
    //with the resolver it doesn't work, I suppose it's because Artifactory doesn't support Maven3
    //we will mange the resolver by changing the settings.xml
    //I'll manage the resolver by changing the settings.xml
    /*rtMavenResolver(id:"MAVEN_RESOLVER",serverId:"server_tutorial",releaseRepo:"libs-release",snapshotRepo:"libs-release")*/
    }
    }
  7. robertobatts revised this gist Nov 17, 2019. 1 changed file with 13 additions and 23 deletions.
    36 changes: 13 additions & 23 deletions JenkinsfileMavenArtifactory
    Original file line number Diff line number Diff line change
    @@ -1,44 +1,36 @@
    pipeline {
    pipeline{
    agent any

    tools {
    jdk 'OpenJDK_1_8_0'
    }

    stages {

    stage ('Artifactory configuration') {
    steps {
    rtServer (
    stages {
    stage('Artifactory config') {
    steps{
    rtServer(
    id: "server_tutorial",
    url: "http://3.134.8.172:8081/artifactory",
    credentialsId: "artifactory-credentials"
    )

    rtMavenDeployer (
    rtMavenDeployer(
    id: "MAVEN_DEPLOYER",
    serverId: "server_tutorial",
    releaseRepo: "libs-release",
    snapshotRepo: "libs-release"
    )

    //with the resolver it doesn't work, I suppose it's because Artifactory doesn't support Maven3
    /*rtMavenResolver (
    id: "MAVEN_RESOLVER",
    serverId: "server_tutorial",
    releaseRepo: "libs-release",
    snapshotRepo: "libs-release"
    )*/
    //we will mange the resolver by changing the settings.xml
    /*rtMavenResolver(id:"MAVEN_RESOLVER",serverId:"server_tutorial",releaseRepo:"libs-release",snapshotRepo:"libs-release")*/
    }
    }

    stage ('Build Maven') {
    stage('Build Maven') {
    steps {
    //set settings.xml with the ID of the config file on Jenkins
    configFileProvider([configFile(fileId: 'MavenArtifactorySettingId', variable: 'MAVEN_SETTINGS_XML')]) {
    retry(count: 3) {
    rtMavenRun (
    tool: "Maven 3.6.2", // Tool name from Jenkins configuration
    rtMavenRun(
    tool: "Maven3.6.2",//Tool name from Jenkins configuration
    pom: 'pom.xml',
    goals: '-U -s $MAVEN_SETTINGS_XML clean install',
    deployerId: "MAVEN_DEPLOYER"/*,
    @@ -48,12 +40,10 @@ pipeline {
    }
    }
    }

    stage ('Publish to Artifactory') {
    stage('Publish to Artifactory') {
    steps {
    rtPublishBuildInfo (serverId: "server_tutorial")
    rtPublishBuildInfo(serverId: "server_tutorial")
    }
    }
    }

    }
  8. robertobatts created this gist Nov 17, 2019.
    59 changes: 59 additions & 0 deletions JenkinsfileMavenArtifactory
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@
    pipeline {
    agent any

    tools {
    jdk 'OpenJDK_1_8_0'
    }

    stages {

    stage ('Artifactory configuration') {
    steps {
    rtServer (
    id: "server_tutorial",
    url: "http://3.134.8.172:8081/artifactory",
    credentialsId: "artifactory-credentials"
    )

    rtMavenDeployer (
    id: "MAVEN_DEPLOYER",
    serverId: "server_tutorial",
    releaseRepo: "libs-release",
    snapshotRepo: "libs-release"
    )

    //with the resolver it doesn't work, I suppose it's because Artifactory doesn't support Maven3
    /*rtMavenResolver (
    id: "MAVEN_RESOLVER",
    serverId: "server_tutorial",
    releaseRepo: "libs-release",
    snapshotRepo: "libs-release"
    )*/
    }
    }

    stage ('Build Maven') {
    steps {
    //set settings.xml with the ID of the config file on Jenkins
    configFileProvider([configFile(fileId: 'MavenArtifactorySettingId', variable: 'MAVEN_SETTINGS_XML')]) {
    retry(count: 3) {
    rtMavenRun (
    tool: "Maven 3.6.2", // Tool name from Jenkins configuration
    pom: 'pom.xml',
    goals: '-U -s $MAVEN_SETTINGS_XML clean install',
    deployerId: "MAVEN_DEPLOYER"/*,
    resolverId: "MAVEN_RESOLVER"*/
    )
    }
    }
    }
    }

    stage ('Publish to Artifactory') {
    steps {
    rtPublishBuildInfo (serverId: "server_tutorial")
    }
    }
    }

    }