Maven 中的用户和项目特定设置
我们同时开发一个项目的多个分支。每个开发人员都有多个工作副本,每个工作副本都使用自己的数据库模式。 (通常每个分支都有一个工作副本,但有时每个分支甚至有多个工作副本。)我们需要让 Maven 知道数据库凭据(对于 db-migration 插件、单元测试、开发实例) servlet)。
我们无法将凭据放入 pom.xml
中,因为每个开发人员可能使用不同的数据库架构名称。我们无法将凭据放入 settings.xml
中,因为每个开发人员都使用多个架构。
我们把凭据放在哪里?
例如,http://code.google.com/p/c5-db-migration / 描述了数据库凭据需要存在于 pom.xml
中,但我想将它们外部化到不受修订控制的文件中。
We develop multiple branches of a project concurrently. Each developer has multiple working copies, each working copy uses its own DB schema. (There will typically be a working copy per branch, but sometimes even more than one working copy per branch.) We need to let Maven know the DB credentials (for the db-migration plugin, for unit tests, for the dev instance of the servlet).
We can't put the credentials in the pom.xml
because each developer might use different DB schema names. We can't put the credentials in settings.xml
because each developer uses more than one schema.
Where do we put the credentials?
For example, http://code.google.com/p/c5-db-migration/ describes that the DB credentials need to be present in pom.xml
but I would like to externalize them out to a file that's not under revision control.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将它们放入项目目录内的属性文件中,但该文件不包含在源代码管理中。
使用 Maven,可以使用
元素 按照此处的说明。You could put them into a properties file inside the project directory but which is excluded from source control.
With Maven it's possible to read properties from an external file by using a
<build><filters><filter>
element as instructed here.阅读以下答案:
或只是:
Read following answers:
or just: