• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

hibernate/gradle-maven-publish-auth: Gradle plugin for managing authentication o ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

hibernate/gradle-maven-publish-auth

开源软件地址(OpenSource Url):

https://github.com/hibernate/gradle-maven-publish-auth

开源编程语言(OpenSource Language):

Java 100.0%

开源软件介绍(OpenSource Introduction):

Maven Repository Auth Plugin

Gradle plugin used to apply credential information defined in Maven config files to Maven repositories used in Gradle builds - both for upload and download

Applying plugin

See https://plugins.gradle.org/plugin/org.hibernate.build.maven-repo-auth for details on how to apply the plugin.

Applying the plugin does a number of things:

  • Creates an extension object org.hibernate.build.publish.auth.maven.MavenRepoAuthExtension and makes it available as mavenRepoAuth for configuration of the plugin behavior. At the moment it just exposes the list of credential providers. Projects could theoretically add additional credential providers, but such use is not supported

  • Finds all maven repository definitions in the project and applies the "matching" credentials. A match is determined based on the name used in the Gradle build and the server id in the Maven config

Examples

Let’s assume we use a Maven repository located at the URL http://repository.average.joes.com and that this repo is password protected. Our Maven settings.xml file contains:

    <settings>
        <servers>
            <server>
                <id>dogdeball-repo</id>
                <username>average-joes</username>
                <password>dodgethis</password>
             </server>
        </servers>
    </settings>

Downloads

To download artifacts from the repository, we configure it in the Gradle build like so:

repositories {
    maven {
        name = 'dogdeball-repo'
        url 'http://repository.average.joes.com'
    }
}

Because the name applied to the repo in the Gradle build matches the id of the server as configured in the Maven settings.xml the plugin will apply the credentials from the Maven settings

Uploads (legacy publishing)

The plugin can also apply the credentials when the legacy approach of publishing via an Upload task available through Gradle’s MavenPlugin. E.g.:

    uploadArchives {
        repositories.mavenDeployer {
            ...
            repository(id: 'dogdeball-repo', url: 'http://repository.average.joes.com')
        }
    }

Again, because the repo-name / server-id match, the credentials will be applied.

Publishing

Gradle also defines a proper DSL for "publications", which is also supported by the plugin:

    publishing {
        repositories {
            maven {
                name = 'dogdeball-repo'
                url 'http://repository.average.joes.com'
            }
        }
    }

Limitations

The plugin does not yet work with buildscript repositories. In the following case, the credentials will not get applied:

    buildscript {
        repositories {
            maven {
                name = 'dogdeball-repo'
                url 'http://repository.average.joes.com'
            }
        }
    }

Gradle Wrapper

To upgrade Gradle Wrapper to a new version, run

sh ./gradlew wrapper --gradle-version NEW_VERSION



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
nebula-plugins/gradle-info-plugin: Plugin to gather information about the enviro ...发布时间:2022-06-11
下一篇:
vRallev/jarjar-gradle发布时间:2022-06-11
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap