uploadArchives to upload sub folders


(Tony) #1

Hello,
I am trying to extract files (and sub folders) out of zip file and upload to Nexus.

I have Gradle task that extracts subfolders and files from zip file and put them in another folder.

task unzip(type:Copy) {
def sourceFolder = file(‘source_folder’)
def outputFolder = file(‘dest_folder’)

from zipTree(sourceFolder)
into outputFolder

}

This extracts the subfolders (and files under) from zip file to “dest_folder”. Now, I want to add uploadArchives using mavenDeployer and upload all the subfolders (and files) in “dest_folder” to Nexsus. Is this correct way to upload the subfolders (and contents)?

configurations { deployjars }

artifacts {
    deployjars file("dest_folder")
}

uploadArchives {
    repositories {
        mavenDeployer {
            configuration = configurations.deployjars
            repository(url:"Nexus server") {
                authentication(username,pasword..)
		pom.version = 'MyVersion'
		pom.artifactId = 'MyArtifact'

            }    
        }
    }
}