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是什么意思?

阅读 6.2k
3 个回答

以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)下

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题