首页 > gradle中,into中的from是什么意思?

gradle中,into中的from是什么意思?

在看教程时,看到这样一个例子。

task dist(type: Zip) {
    dependsOn spiJar
    from 'src/dist'
    into('libs') {
        from spiJar.archivePath
        from configurations.runtime
    }
}

artifacts {
   archives dist
}

不知道into中的from是什么意思?


以zip类型发布Jar包,依赖了任务spiJar,从目录(from)src/dist 添加到(打包进)(into)build/libs/


可以看下dsl文档zip中的into描述是这样的into(destPath, configureClosure),第一个参数接收一个路径,第二个参数接收一个闭包,官方的说明是
`
Creates and configures a child CopySpec with a destination directory inside the archive for the files
`
也就是说可以把里面这两个当成附加项,为第一个参数指定的libs附加其它位置(可以是上面from路径之外的)的文件进去


把某个文件夹下的文件(from)打包到其他文件夹(into)下

【热门文章】
【热门文章】