简体   繁体   English

如何为生产和开发维护不同的maven环境?

[英]How to maintain different maven environments for production and development?

In a Java world where people use Maven/Ivy to manage dependencies, how should one maintain multiple environments/repositories (artifactory) for production and development environments?在人们使用 Maven/Ivy 管理依赖关系的 Java 世界中,应该如何为生产和开发环境维护多个环境/存储库(工件)?

The developers need to have a local repository for development (and sharing prototype libraries) where as a few of the jars need to be available in the Production repository.开发人员需要有一个用于开发(和共享原型库)的本地存储库,其中一些 jars 需要在生产存储库中可用。 Some of the projects should build seamlessly in development environment and production.一些项目应该在开发环境和生产环境中无缝构建。

This can be achieved by maintaining separate repository URL's in different environment, but what is the best way to do it, with minimal changes in configurations (pom.xml).这可以通过在不同的环境中维护单独的存储库 URL 来实现,但是最好的方法是什么,只需对配置 (pom.xml) 进行最小的更改。

What can be the approaches to automate this?有什么方法可以实现自动化?

Update: Also a good feature to have would be least config (eg pom.xml) required to start a new project.更新:启动新项目所需的最少配置(例如 pom.xml)也是一个不错的功能。 But it is ok set up the development machine once with a settings file (eg $M2_HOME/settings.xml)但是可以使用设置文件(例如 $M2_HOME/settings.xml)设置开发机器一次

You may want to consider profiles.您可能需要考虑配置文件。 They support repository override.它们支持存储库覆盖。 http://maven.apache.org/guides/introduction/introduction-to-profiles.html http://maven.apache.org/guides/introduction/introduction-to-profiles.html

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

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