How to uploadXxxxxx artifact (connect the configuration with Xxxx)


(hw.kirk) #1

I am missing something(s) to perform an upload of a file created by the task ‘dbFiles’. Returning to gradle after a 2-year absence. I suspect I am not connecting the “dbfiles” configuration to the upload task.

  1. What do I need to add to my code to upload “build/dbfile.txt” ?
  2. How to I specify the group and version of the uploaded file

Thanks

apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'maven'

configurations {
    dbfiles 
}

uploadDbfiles {  
    repositories {  
        mavenDeployer {  
            repository(url: 'http://nexus01p:8081/nexus/content/repositories/testreleases') {  
                authentication(userName: 'jenkins.automation', password: System.getenv("JENKINS_AUTO_PW"));  
            }  
        }  
    }  
}

task('buildDbfiles') << {
  String myFileName = 'build/dbfile.txt'
  logger.lifecycle 'creating ' + myFileName
  mkdir project.buildDir  
  File configFile = file(new File("build/dbfile.txt"))
  configFile.write('foo')
}