本文介绍了使用 Maven 外部化 SCM 凭证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以将我的 SCM 凭据具体化,这样它们就不会存储在项目的 POM 中?问题是,如果它们包含在项目的 POM 中,那么在项目部署时它们将对所有人可见.

Is there a method to externalize my SCM credentials so they are not stored in the project's POM? The problem being if they're contained in the project's POM, they will be visible to all when the project is deployed.

推荐答案

这可以为许多 SCM 提供者完成,我假设 Subversion 作为基于您的标记的实现.

This can be done for many of the SCM providers, I assume Subversion as the implementation based on your tag.

您可以在 $user.home/.scm/svn-settings.xml(或 [maven home]/conf/.scm/svn-settings.xml,尽管这意味着它们仍然可见)中定义您的 Subversion 设置系统用户)

You can define your Subversion settings in $user.home/.scm/svn-settings.xml (or [maven home]/conf/.scm/svn-settings.xml, though this means they'll still be visible to users of the system)

在该文件中,您可以设置 Subversion 服务器的用户名和密码.文件内容应如下所示:

In that file you can set your username and password for the Subversion server. The file contents should look like this:

<svn-settings>
  <user>[svn user]</user>
  <password>[svn password]</password>
</svn-settings>

您可以在该配置文件中定义一些其他属性.有关更多详细信息,请参阅提供程序配置".Subversion SCM 页面的部分.

You can define some other properties in that configuration file. For more details see the "Provider Configuration" section of Subversion SCM page.

其他 SCM 提供者有类似的方法,例如在 CVS 中,设置存储在同一位置(.scm 文件夹)的 cvs-settings.xml 中,请参阅 CVS SCM 页面 了解详情.

Other SCM providers have a similar approach, for example in CVS the settings are stored in cvs-settings.xml in the same location (the .scm folder), see the CVS SCM page for details.

这篇关于使用 Maven 外部化 SCM 凭证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 19:49
查看更多