如何在gradle.settings中的pluginManagement块中添加私有回购?
我正试图建立一个Gradle5项目,它使用一个自定义插件有人开发,并可在我的公司内部存储库 到目前为止,我们一直采用以下方法导入:如何在gradle.settings中的pluginManagement块中添加私有回购?,gradle,Gradle,我正试图建立一个Gradle5项目,它使用一个自定义插件有人开发,并可在我的公司内部存储库 到目前为止,我们一直采用以下方法导入: buildscript { ext { usr = System.env.usr != null ? System.env.usr : project.ext.properties.usr pass = System.env.pass != null ? System.env.pass : project.ext.proper
buildscript {
ext {
usr = System.env.usr != null ? System.env.usr : project.ext.properties.usr
pass = System.env.pass != null ? System.env.pass : project.ext.properties.pass
privateRepo = {
name "privateRepo"
url <url>
credentials {
username usr
password pass
}
}
}
repositories {
maven (privateRepo)
}
dependencies {
// various dependencies
classpath "org.something:some-plugin:1.0"
...
}
apply plugin: "someplugin"
buildscript{
分机{
usr=System.env.usr!=null?System.env.usr:project.ext.properties.usr
pass=System.env.pass!=null?System.env.pass:project.ext.properties.pass
privateRepo={
名称“privateRepo”
网址
证书{
用户名usr
密码通行证
}
}
}
存储库{
maven(privateRepo)
}
依赖关系{
//各种依赖关系
classpath“org.something:someplugin:1.0”
...
}
应用插件:“someplugin”
就像。
据我所知,这是一种不推荐的方法,因此我想使用pluginManagement
block gradle.settings(同样,如中所建议)
问题是我的存储库是私有的,所以我需要定义用户并传递变量
我在gradle.settings中的pluginManagement
块中尝试了类似的方法,但我无法让它工作:pluginManagement
不支持ext
块,pluginManagement
必须是脚本中的第一个块,这限制了我的选择
我是否可以定义变量,以便在pluginManagement
块中使用它?
免责声明:我的问题与链接的问题不同,因为我的问题与凭证部分有关,我在定义变量和值时遇到问题