简体   繁体   English

在Maven中使用小型数据库而不是settings.xml进行值过滤

[英]Filtering of values using a small databases instead of settings.xml in maven

Correct me if I'm wrong but one normally puts deployment or user-specific properties (eg development/testserver settings) inside settings.xml. 如果我错了,请纠正我,但通常可以将部署或用户特定的属性(例如,开发/测试服务器设置)放在settings.xml中。 And by specifying which profiles to use, we can change the behaviour of the maven build. 通过指定要使用的配置文件,我们可以更改Maven构建的行为。

However there are usually settings in the profiles (settings.xml) which should be shared. 但是,配置文件(settings.xml)中通常有应共享的设置。 Since I don't want to check in settings.xml, I want the maven build to query a database for those profile settings & do the filtering. 由于我不想检入settings.xml,因此我希望Maven构建可以在数据库中查询那些配置文件设置并进行过滤。 Is this possible via some plugin ? 是否可以通过某些插件?

Correct me if I'm wrong but one normally puts deployment or user-specific properties (eg development/testserver settings) inside settings.xml. 如果我错了,请纠正我,但通常可以将部署或用户特定的属性(例如,开发/测试服务器设置)放在settings.xml中。 And by specifying which profiles to use, we can change the behaviour of the maven build. 通过指定要使用的配置文件,我们可以更改Maven构建的行为。

Well, settings.xml is not the best choice for profiles if you don't want to make your build non portable. 好吧,如果您不想使构建不可移植,则settings.xml不是配置文件的最佳选择。 You should actually put profiles in the pom.xml of your project instead and use settings.xml for "secret" things only. 您实际上应该将配置文件放到项目的pom.xml ,并将settings.xml仅用于“秘密”事物。 See chapter 11.5. 请参阅第11.5 Tips and Tricks of Sonatype's Maven book. Sonatype的Maven书的技巧和窍门 Actually, I'd suggest to read the whole chapter 11. Build Profiles . 实际上,我建议阅读整章11. Build Profiles

However there are usually settings in the profiles (settings.xml) which should be shared. 但是,配置文件(settings.xml)中通常有应共享的设置。 Since I don't want to check in settings.xml, I want the maven build to query a database for those profile settings & do the filtering. 由于我不想检入settings.xml,因此我希望Maven构建可以在数据库中查询那些配置文件设置并进行过滤。 Is this possible via some plugin ? 是否可以通过某些插件?

Well, as I said, putting the profiles in the pom.xml should solve this (and I don't know if such a plugin exists). 嗯,正如我所说,将配置文件放在pom.xml应该可以解决此问题(而且我不知道是否存在这样的插件)。 An intermediary solution would be to use profiles and filters as described in this blog post but this isn't much different. 中间解决方案是使用此博客文章中所述的配置文件和过滤器 ,但这没有太大区别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM