1

我是 Gradle 的新手,所以如果我的问题不正确,请原谅我。我正在使用分发插件来创建我的项目的 ZIP 文件。我想在我的项目中实现 YAJSW Wrapper 服务。在 Maven 中,我们可以使用 Assembly Plugin 来定义哪个依赖项去哪里,但是在 Gradle 中我真的找不到单独访问每个依赖项的方法。

我到处寻找,但无法真正找到解决方案。我正在尝试将编译配置的依赖项复制到不同的文件夹中。只要我知道文件名,我就可以包含我想要的任何内容(因为配置是一个文件集合)。但是,我也想复制那些我不知道的传递依赖项(我知道我可以单独查找文件,但我不希望它是这么多的手动工作)。下面是我的代码的一部分,让您了解我现在正在做什么:

distributions {
main {
    baseName "BaseZIP"
    contents {
        from { "src/main/resources" }            
        into('service') {
            from(project.configurations.compile) {
                include 'wrapper**'
            }
        }
        into('service/lib/core/commons') {
            from(project.configurations.compile) {
                include 'commons-cli**'
                include 'commons-collections**'
                include 'commons-configuration**'
                include 'commons-io**'
                include 'commons-logging**'
                include 'commons-vfs2**'
                include 'commons-lang**'
            }
        }}

你能帮我吗?我可能完全错过了一些概念。我希望我的问题是有道理的:(提前谢谢!

4

0 回答 0