Upload a groovy file from the local machine to the groovyCommand

16 views
Skip to first unread message

Charles Moulliard

unread,
Dec 21, 2020, 2:14:46 PM12/21/20
to Jenkins Users
Hi

How can we upload a groovy file from a local machine to the jenkins instance - workspace as the following reports the error within a FreeStyle project "ERROR: (script, line 81) File backupPOM.groovy does not exist in workspace" ?

mavenJob('check-bom-dependencies') {
    description 'Maven Job checking the BOM dependencies of the Spring Boot project'

    logRotator {
        numToKeep 3
    }

    parameters {
        stringParam('TAG', '2.3.4.Final',
                'The release version for the artifact. If you leave this empty, ' +
                        'the current SNAPSHOT version will be used with the ' +
                        '"-SNAPSHOT" suffix removed (example: if the current version ' +
                        'is "1.0-SNAPSHOT", the release version will be "1.0").')
    }

    scm {
        git {
            remote {
                url 'https://github.com/snowdrop/spring-boot-bom'
                branch '$TAG'
            }
        }
    }

    preBuildSteps {
            groovyCommand(readFileFromWorkspace('backupPOM.groovy')) {
                groovyInstallation('groovy3')
              }
    }

    rootPOM 'pom.xml'
    goals '-B dependency:tree'
}

Regards
Charles
Reply all
Reply to author
Forward
0 new messages