Gradle Distribution Task Output Files Not at Root of ZIP

守給你的承諾、 提交于 2019-12-03 10:28:22

Using into '/' seems to do the trick:

contents {
    from {
        'src/main/groovy'
    }
    into '/'
}

Unfortunately, penfold's answer did not work for me. Here is the solution I came up with:

task Package(type: Zip) {

    from {
        def rootScriptFiles = [] // collection of script files at the root of the src folder
        new File('src/main/groovy/').eachFile { if (it.name.endsWith('.groovy')) rootScriptFiles.add(it) }


        ['build/libs/',                 // build binaries
         'src/res/',                    // resources
         rootScriptFiles,               // groovy root source files
        ]
    }
    baseName = pluginName
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!