【问题标题】:Custom publication plugin in gradlegradle 中的自定义发布插件
【发布时间】:2017-11-09 14:25:18
【问题描述】:

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

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

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

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

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

【问题讨论】:

    标签: gradle publish gradle-plugin


    【解决方案1】:

    听起来您需要创建一个 CustomPublisher 来扩展 PublicationContainer 使用的 PublicationContainer

    更新:

    我从 gradles 文档中添加了一个关于 configuration of the upload task 的代码 sn-p

    repositories {
    flatDir {
        name "fileRepo"
        dirs "repo"
    }
    }
    
    uploadArchives {
    repositories {
        add project.repositories.fileRepo
        ivy {
            credentials {
                username "username"
                password "pw"
            }
            url "http://repo.mycompany.com"
        }
    }
    }
    

    【讨论】:

    • 任何示例自定义实现示例?
    • 因此查看文档here,您似乎可以在不创建自定义发布者的情况下发布工件。我会用那里给出的例子来更新我的答案。实施自定义发布者是否有特定原因?
    猜你喜欢
    • 2020-04-09
    • 1970-01-01
    • 1970-01-01
    • 2017-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多