2017-08-29 100 views
0

根據GIT中正在更改的文件,我的gradle build會產生不同數量的工件。因此,如果例如file1.txt被更改,它將只產生file1.zip,如果file1.txt和file2.txt都被更改,則會產生2個文件 - file1.zip和file2.zip等。創建動態gradle發佈

對於每一個改變的文件我動態地創建新的任務:

def task = tasks.create(
     name: "zip:$component", 
     type: Zip, 
     overwrite: true) { 
    from project.CONFIG_DIR 
    include "$component/component.conf" 
    baseName component 
    destinationDir file("out") 

現在我要發佈所產生的輸出/ *拉鍊文物,Maven倉庫。 試圖用做:

publishing.publications.add(task) 

卻得到了以下幾點:

> org.gradle.api.tasks.bundling.Zip_Decorated cannot be cast to org.gradle.api.Named 

回答