gradle - copy file after its generation

后端 未结 4 556
情歌与酒
情歌与酒 2020-12-09 08:44


I try to build jar and after that copy it to another folder.

task createJar(type: Jar) {
    archiveName = \"GradleJarProject.jar\"
    manifest {
             


        
4条回答
  •  没有蜡笔的小新
    2020-12-09 09:07

    I think the above answer is somehow old. Here is an answer using gradle 3.3

    jar {
        baseName = 'my-app-name'
        version =  '0.0.1'
    }
    
    task copyJar(type: Copy) {
        from jar // here it automatically reads jar file produced from jar task
        into 'destination-folder'
    }
    
    build.dependsOn copyJar
    

提交回复
热议问题