java 我如何向 Maven 询问默认存储库的列表?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2877436/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 23:14:46  来源:igfitidea点击:

How can I ask Maven for a list of the default repositories?

javamaven-2build-process

提问by Derek Mahar

What command can I use to ask Maven for a list of the default repositories that it searches for its dependencies? If no such command exists, where else may I look to find this default list?

我可以使用什么命令向 Maven 询问它搜索其依赖项的默认存储库列表?如果不存在这样的命令,我还能在哪里找到这个默认列表?

回答by Sean Patrick Floyd

on the command line, execute

在命令行,执行

mvn help:evaluate

then, when prompted, enter

然后,当出现提示时,输入

${project.repositories}

see http://maven.apache.org/plugins/maven-help-plugin/evaluate-mojo.html

http://maven.apache.org/plugins/maven-help-plugin/evaluate-mojo.html

回答by tangens

You can output the effective pomwith the command

您可以使用命令输出有效的pom

mvn help:effective-pom

There the default repositories are listed.

那里列出了默认存储库。

回答by Adrian

Use the Maven Dependency Pluginto show repositories for a specific build:

使用Maven Dependency Plugin显示特定构建的存储库:

mvn dependency:list-repositories

or the full path, if you still use a very old version (<2.2)

或完整路径,如果您仍然使用非常旧的版本(<2.2)

mvn org.apache.maven.plugins:maven-dependency-plugin:2.6:list-repositories

回答by Derek Mahar

As a side-effect of displaying newer versions, the versions:display-dependency-updatesgoal of the Versions Maven Pluginalso displays the names of the repositories that it searches. To display the newer versions and the repository names, run

作为显示较新版本的副作用,Versions Maven Pluginversions:display-dependency-updates目标还显示它搜索的存储库的名称。要显示较新的版本和存储库名称,请运行

mvn versions:display-dependency-updates