处理 Java Web 应用程序版本控制的最佳方法是什么?
我有一个标准 Java 应用程序,可以处理 REST 和 UI 调用。创建和管理应用程序版本 (major.minor.release.build) 的最佳方式是什么?我在堆栈中使用 Subversion、Maven、Bamboo(持续构建)和 Spring。我希望该版本能够与 SVN、Bamboo 和 Maven 捆绑在一起。并且,希望能够在启动时记录版本——可能使用一些 Spring bean。
必须有一个框架/模式来帮助解决这个问题。我宁愿不自己动手。
谢谢你!
I have a standard Java application that handles both REST and UI calls. What is the best way for me to create and manage an application version (major.minor.release.build)? I'm using Subversion, Maven, Bamboo (continuous build) and Spring in the stack. I would like the version to be tied together with SVN, Bamboo and Maven. And, would like to be able to log version on start-up -- likely using some Spring bean.
There must be a framework/pattern out there to help with this. I'd rather not roll my own.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不使用语义版本控制?这是当今大多数人所期望的,它的定义非常明确并且已经存在。对我来说足够好了。
Maven 有一个发布插件。首先设置起来很困难,但是一旦它工作起来,它就会很好地工作。它完成了确保所有内容都干净签入、正确标记以及使用版本号发挥作用的所有细节。这不是一个值得期待的要求,但至少现在已经做得很好了。设置一些 Maven 存储库是值得的。我们使用 Nexus 并且可以推荐它,但我也听说了 artificiality 的好东西。
在测试过程中,我们不太依赖 Maven 版本,而是依赖内部版本号,我们将其放在网页和类似工件上的离散位置,以便我们可以快速确定我们正在讨论的确切版本。我们使用 hudson,它在环境变量中提供内部版本号,但 Bamboo 也必须提供该版本号。过滤器复制功能使这变得非常简单。
Hudson 使用内部版本号标记 VCS(我们使用 git,但这并不重要),而 Maven 发布插件则标记版本。
Why not use Semantic Versioning? It is what most people expect nowadays, it is pretty well defined and it is out there. Good enough for me.
Maven has a release plugin. This is a bear to setup first but once it is working it works well. It does all the nitty gritty of making sure everything is cleanly checked in, tagged properly, and does the magic with the version numbers. It is not a ask to look forward to, but at least now it is properly done. It pays to setup some maven repository. We use Nexus and can recommend that, but I heard good things of artifactory too.
During testing we do not rely on the maven version too much but on the build number, which we put in a discrete place on the web pages and similar artifacts so we can quickly determine which exact build we're talking about. We use hudson which provides the build number in an environment variable, but Bamboo must provide that too. The filter copy functionality makes that pretty straightforward.
Hudson tags the VCS (we use git, but that does not matter) with the build number and the maven release plugin tags the releases.
您可以使用 maven build-number 插件 (http:// /mojo.codehaus.org/buildnumber-maven-plugin/),例如在已过滤的资源中,例如属性文件。
如果您使用 Artifactory 作为二进制存储库,那么它还可以使用构建号标记您的二进制工件,并具有从工件到创建它的 CI 服务器构建的完整可追溯性。目前,Hudson、TeamCity 和 Bamboo 支持此功能。
You can include the SCM revision number in your artifact using the maven build-number plugin (http://mojo.codehaus.org/buildnumber-maven-plugin/), e.g. in a filtered resource, such as a properties file.
If you are using Artifactory as your binary repo then it can also tag your binary artifacts with a build number and have full traceability from your artifact to the CI server build that created it. Currently this is supported with Hudson, TeamCity and Bamboo.