gradle中的自定义发布插件

时间:2017-11-09 14:25:18

标签: gradle publish gradle-plugin

我想为gradle实现自定义发布插件。

我的目标是支持这样的语法:

publishing {
    publications {      
        custom(CustomPublication) {
            artifact fooDistZip
            artifact foo2DistZip
        }
    }
    repositories {
        custom {
            url 'http://192.168.1.100:80'
        }
    }
}

我检查了MavenPublication,但实现似乎相当复杂。

非常感谢Gradle中简单自定义发布者的任何参考。

1 个答案:

答案 0 :(得分:1)

听起来你想要创建一个自定义发布者来扩展Publisher消耗的PublicationContainer

更新

我添加了有关configuration of the upload task

的gradles文档的代码段
repositories {
flatDir {
    name "fileRepo"
    dirs "repo"
}
}

uploadArchives {
repositories {
    add project.repositories.fileRepo
    ivy {
        credentials {
            username "username"
            password "pw"
        }
        url "http://repo.mycompany.com"
    }
}
}
相关问题