Upload a groovy file from the local machine to the groovyCommand

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Upload a groovy file from the local machine to the groovyCommand

Charles Moulliard

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')) {

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


You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0d0bf936-b5d3-4b0b-bca8-e34f93af4c3bn%40googlegroups.com.