Gradle分发任务输出文件不在ZIP的根目录 [英] Gradle Distribution Task Output Files Not at Root of ZIP

查看:161
本文介绍了Gradle分发任务输出文件不在ZIP的根目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个简单的Gradle构建,将./src/main/groovy的内容导出到一个zip文件中。该zip文件包含一个与zip文件名称完全相同的文件夹。我不知道如何使用分发插件将文件放入zip文件的根目录。

I created a simple Gradle build that exports the contents of ./src/main/groovy to a zip file. The zip file contains a folder with the exact same name as the zip file. I cannot figure out how to get the files into the root of the zip file using the distribution plugin.

即, gradlew clean distZip 产生:

i.e. gradlew clean distZip produces:


helloDistribution-1.0.zip - > helloDistribution-1.0 - >文件

helloDistribution-1.0.zip -> helloDistribution-1.0 -> files

我喜欢:

what I would like:


helloDistribution-1.0.zip - > files

我的build.gradle文件:

My build.gradle file:

apply plugin: 'groovy'
apply plugin: 'distribution'

version = '1.0'

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

我试图通过在{'dir中添加来解决这个问题'但无济于事。

I have attempted to fix the problem by adding into { 'dir' } but to no avail.

推荐答案

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

这篇关于Gradle分发任务输出文件不在ZIP的根目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆