将Java代码部署到生产中的最佳方法是什么? [英] What are the best methods for deploying java code to production?
问题描述
当前,我们有一个Java Restlet API,其依赖关系是通过Maven控制的.当我们更新API时,我们运行maven assembly:assembly,它对单元进行测试等等,并生成一个jar文件.然后,我们将其上传到生产服务器并使用nohup运行它.
Currently we have a Java Restlet API with dependencies controlled via Maven. When we update the API we run maven assembly:assembly which does the unit tests etc and produces a single jar file. We then upload this to the production server and run it using nohup.
是否有更好或更自动化的方法?像哈德森这样的地方会进来吗?
Is there a better or more automated way of doing this? Is this where something like Hudson would come in?
谢谢
推荐答案
我的经验涉及到webapp部署.但是,这里也应如此.使用 Maven ,货物, Nexus (或哈德森,可能还包括 Jira .
My experience goes with webapp-deployment. But same should hold true here. Use Maven, Cargo, Nexus (or Artifactory), Hudson and probably, Jira in conjunction of product release.
自动发布过程更可靠,因为其中没有人为因素可能会忘记一个步骤.
Automated release process are more reliable because there is no human factor involved that may forget a step.
我们还将Liquibase用于数据库版本控制.并且,如果您要处理应用程序部署中的数据库更改.您会发现Liquibase在运行Alter脚本时大大增强了信心.
We also use Liquibase for database versioning. And, if you are dealing with database changes in your application deployment. You'll realize Liquibase boosts so much confidence while running alter scripts.
我建议您阅读以下资源
- 使用Maven自动部署-整整走完九码如果可以的话,请按照这种模式进行操作.
- Maven 2有效实施 –这本书确实对我们有很大帮助.
- Automated Deployment with Maven - going the whole nine yards If you can, literally follow this pattern.
- Maven 2 Effective Implementation -- this book really helped us a lot.
这篇关于将Java代码部署到生产中的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!