将MavenRepository配置添加到自定义插件时出现Gradle错误:"Please specify which subtype of Authentication to create"



我正试图将maven约定添加到我的一个插件中,以便以标准化的方式发现用户凭据。当我添加凭据关闭时,我遇到以下错误:

* What went wrong:
An exception occurred applying plugin request [id: 'my.plugin']
> Failed to apply plugin [id 'my.plugin']
> Cannot create a Authentication named 'BasicAuthentication' because this container does not support creating elements by name alone. Please specify which subtype of Authentication to create. Known subtypes are: AwsImAuthentication, BasicAuthentication, DigestAuthentication, HttpHeaderAuthentication

我终于明白了。诀窍是在插件中包括基本身份验证:

import org.gradle.authentication.http.BasicAuthentication;
class MyPlugin implements Plugin<Project> {
@Override
void apply(Project project) {

相关内容

最新更新