如何列出为项目配置的所有存储库?
背景:我有一个非常复杂的gradle构建脚本和cannot get my NetBeans to download the sources maven依赖项。在该问题报告中,我建议仔细检查导入mavenCentral
的顺序。
答案 0 :(得分:25)
对于任何感兴趣的人,这里是列出已加载的存储库的代码(感谢@kelemen):
task listrepos {
doLast {
println "Repositories:"
project.repositories.each { println "Name: " + it.name + "; url: " + it.url }
}
}
将此代码添加到构建脚本后,执行gradle listrepos
和voilà...
答案 1 :(得分:1)
如果有人来此页面寻找与@Alberto的答案等效的Kotlin(build.gradle.kts),则可以按以下步骤进行操作:
y
请注意,在Kotlin版本中,强制转换为<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000">
<!-- Grey Original -->
<path fill="#555" d="M500 500 400 400 400 600 600 600 600 400z" />
<!-- Red Transform [50% of ((1000 / 8) - 1000) is -437.5] -->
<path fill="rgb(255, 0, 0)" d="M500 500 400 400 400 600 600 600 600 400z" transform="scale(8) translate(-437.5, -437.5)" />
<!-- Orange Transform [50% of ((1000 / 4) - 1000) is -375] -->
<path fill="rgb(255, 125, 0)" d="M500 500 400 400 400 600 600 600 600 400z" transform="scale(4) translate(-375, -375)" />
<!-- Yellow Transform [50% of ((1000 / 2) - 1000) is -250] -->
<path fill="rgb(255, 255, 0)" d="M500 500 400 400 400 600 600 600 600 400z" transform="scale(2) translate(-250, -250)" />
<!-- Green Transform [50% of ((1000 / 1) - 1000) is 0] -->
<path fill="rgb(0, 125, 0)" d="M500 500 400 400 400 600 600 600 600 400z" transform="scale(1) translate(0, 0)" />
<!-- Blue Transform [50% of ((1000 / 0.5) - 1000) is 500] -->
<path fill="rgb(0, 0, 125)" d="M500 500 400 400 400 600 600 600 600 400z" transform="scale(0.5) translate(500, 500)" />
<!-- Indigo Transform [50% of ((1000 / 0.25) - 1000) is 1500] -->
<path fill="rgb(63, 0, 255)" d="M500 500 400 400 400 600 600 600 600 400z" transform="scale(0.25) translate(1500, 1500)" />
<!-- Violet Transform [50% of ((1000 / 0.125) - 1000) is 3500] -->
<path fill="rgb(199, 125, 243)" d="M500 500 400 400 400 600 600 600 600 400z" transform="scale(0.125) translate(3500, 3500)" />
</svg>
才能获得with cte as (
select idchild, idparent,
convert(varchar(max), idchild) as children
from family f
where not exists (select 1 from family f2 where f2.idparent = f.idchild)
union all
select f.idchild, f.idparent,
concat(f.idchild, ',', cte.children)
from cte join
family f
on cte.idparent = f.idchild
)
select *
from cte
order by idchild;
属性。如果您不添加Maven存储库,则对您而言可能会有所不同。
答案 2 :(得分:0)
尝试使用Alberto's task from his answer时遇到以下错误,因为我定义了一个插件存储库:
No such property: url for class: org.gradle.plugin.use.internal.PluginDependencyResolutionServices$PluginArtifactRepository
为避免此错误,我对任务逻辑做了一些更改:
task listrepos {
doLast {
println "Repositories:"
project.repositories.each {
if (it.name == '__plugin_repository__Gradle Central Plugin Repository') {
println "Name: " + it.name + "; url: " + it.url
} else {
println "Name: " + it.displayName
}
}
}
}