如何使用maven命令行来确定maven正在拾取哪个settings.xml文件?
当前回答
如果您像我一样在调试和浪费时间,这将提供包括密码在内的详细信息。: P
mvn help:effective-settings -DshowPasswords=true
其他回答
确定Maven是否正在使用所需的settings.xml的快速且肮脏的方法将使其xml无效,并运行一些需要settings.xml的安全Maven命令。
如果它读取了settings.xml,那么Maven会报告一个错误:“读取settings.xml时出错…”
您可以使用maven帮助插件来告诉您用户和全局设置文件的内容。
mvn help:effective-settings
将要求maven吐出组合的全局和用户设置。
这是Maven的配置文件。它可以在两个级别上指定:
User Level. This settings.xml file provides configuration for a single user, and is normally provided in ${user.home}/.m2/settings.xml. NOTE: This location can be overridden with the CLI option: -s /path/to/user/settings.xml Global Level. This settings.xml file provides configuration for all Maven users on a machine (assuming they're all using the same Maven installation). It's normally provided in ${maven.home}/conf/settings.xml. NOTE: This location can be overridden with the CLI option: -gs /path/to/global/settings.xml
全局变量的M2_HOME环境变量。参见设置参考:
The settings element in the settings.xml file contains elements used to define values which configure Maven execution in various ways, like the pom.xml, but should not be bundled to any specific project, or distributed to an audience. These include values such as the local repository location, alternate remote repository servers, and authentication information. There are two locations where a settings.xml file may live: The Maven install: $M2_HOME/conf/settings.xml A user's install: ${user.home}/.m2/settings.xml
使用-X选项启动maven(调试)并检查输出的开头。应该是这样的:
...
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from c:\....\apache-maven-3.0.3\conf\settings.xml
[DEBUG] Reading user settings from c:\....\.m2\settings.xml
[DEBUG] Using local repository at C:\....\repository
...
(原来的目录名称被我删除了)
推荐文章
- 使iTerm以与其他操作系统相同的方式翻译“元键”
- 如何设置我的phpmyadmin用户会话不超时这么快?
- 在maven中安装mvn到底做什么
- Gradle替代mvn安装
- 如何合并2 JSON对象从2个文件使用jq?
- 如何在POM.xml中引用环境变量?
- Maven project.build.directory
- 如何触发命令行PHP脚本的XDebug分析器?
- Spring Boot -父pom,当你已经有一个父pom
- 使用Maven复制文件的最佳实践
- Maven命令行如何指向特定的settings.xml为单个命令?
- 如何循环通过文件匹配通配符在批处理文件
- 点击按钮时如何打开手机设置?
- 我怎么能显示线在公共(反向差异)?
- Maven使用多个src目录编译