Java Spring Tool Suite中maven使用的settings.xml在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21537405/
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-08-13 09:14:36  来源:igfitidea点击:

Where is the settings.xml used by maven in the Spring Tool Suite?

javaeclipsespringmaven

提问by isaac.hazan

I'd like to set the ftp servers for deploying from STS as described here: http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploy-ftp.html

我想设置用于从 STS 部署的 ftp 服务器,如下所述:http: //maven.apache.org/plugins/maven-deploy-plugin/examples/deploy-ftp.html

It should be in the settings.xml. According to documentation settings is in either of 2:

它应该在settings.xml 中。根据文档设置是在 2 之一:

  • The Maven install: $M2_HOME/conf/settings.xml
  • A user's install: ${user.home}/.m2/settings.xml
  • Maven 安装:$M2_HOME/conf/settings.xml
  • 用户安装:${user.home}/.m2/settings.xml

Where is the $M2_HOME. In other terms when working from STS(Eclipse), what is the installation folder for maven in this case. I can't find a settings.xml in ${user.home}/.m2/ . I worked under Windows 7

$M2_HOME 在哪里。换句话说,当从 STS(Eclipse) 工作时,在这种情况下 maven 的安装文件夹是什么。我在 ${user.home}/.m2/ 中找不到 settings.xml。我在 Windows 7 下工作

Those 2 threads are related but do not provide a clear answer that worked for me at least:

这两个线程是相关的,但没有提供至少对我有用的明确答案:

Thx in advance

提前谢谢

采纳答案by Nicola Musatti

I may be off-mark as I've never used STS myself, but if I understand correctly it is just a pre-packaged Eclipse distribution. If I'm correct your installation only contains an embedded version of Maven, but not a command line accessible one. You need to install one from here.

我可能不符合标准,因为我自己从未使用过 STS,但如果我理解正确的话,它只是一个预先打包的 Eclipse 发行版。如果我是对的,您的安装仅包含嵌入式版本的 Maven,而不包含可访问的命令行版本。你需要从这里安装一个。

With the 3.x releases of Eclipse I found that you need to have your installation point to an external Maven installation for Eclipse to make use of the settings.xmlfiles. Once you installed a downloaded version you can choose Window -> Preferences -> Maven -> Installations, press Add...and point to the version you just installed.

对于 Eclipse 的 3.x 版本,我发现您需要将安装指向一个外部 Maven 安装,以便 Eclipse 使用这些settings.xml文件。安装下载的版本后,您可以选择Window -> Preferences -> Maven -> Installations,按Add...并指向您刚刚安装的版本。

回答by Kick

Global maven settings.xml exist at apache-maven-3.0.4\conf\settings.xml[inside the maven installation]

全局 maven settings.xml 存在于apache-maven-3.0.4\conf\settings.xml[maven 安装内部]

and

Local maven settings.xml exist at C\Users\[username]\.m2\settings.xml[window OS install on C drive]

本地 maven settings.xml 存在于C\Users\[username]\.m2\settings.xml[window OS install on C drive]

回答by Harm op den Akker

In Spring Tools Suite (3.6.1):

在 Spring 工具套件 (3.6.1) 中:

Windows - Preferences - Maven - User Settings, you can select which global- and user- version of the settings.xml to use.

Windows - 首选项 - Maven - 用户设置,您可以选择要使用的 settings.xml 的全局和用户版本。