[英]What would you use for deployment scripts in Java?
I'm working on a Java web project that uses Maven to build its artifacts. 我正在研究一个使用Maven构建其工件的Java Web项目。 At the end of the Maven build we have a few jar and war files that we need to deploy onto our development/testing environment.
在Maven构建结束时,我们需要将一些jar和war文件部署到我们的开发/测试环境中。
Right now we're using a pretty hefty Ant script that performs several tasks (on both Windows/Linux machines) 现在我们正在使用一个非常庞大的Ant脚本来执行多个任务(在Windows / Linux机器上)
Ant does the job well - but the script is quickly getting very large, and to be honest, it feels inadequate for the task at hand. Ant可以很好地完成工作 - 但是脚本很快变得非常大,而且说实话,它对于手头的任务感觉不够。
Are there other alternatives? 还有其他选择吗? I've heard of gant, but I'm not sure that's the right way to go.
我听说过,但我不确定这是正确的方法。
Thanks for helping! 谢谢你的帮助!
EDIT: after more research, I found out about Gradle - it seems like a very good combination of reusing ant tasks and allowing real scripts to run. 编辑:经过更多的研究,我发现了Gradle - 它似乎是重用ant任务和允许真正的脚本运行的非常好的组合。 It's worth a read.
值得一读。
Yes, take a look at the Cargo plugin for maven: 是的,看看maven的Cargo插件:
* Deploying to a running container * Generating a container configuration deployment structure * Merging WAR files * Starting and stopping a container
Hudson - a continuous integration engine - can be used to achieve these tasks as well. Hudson - 一个持续集成引擎 - 也可用于实现这些任务。
Deployment in general is not easy (and often very specific) and while the Cargo maven plugin may help for the remote deployment of war/ear (if remote deployment for your app server is implemented), I don't think it will cover all your needs. 一般来说部署并不容易(通常非常具体),而Cargo maven插件可能有助于远程部署war / ear(如果实现了app服务器的远程部署),我认为它不会覆盖你的所有需要。 Actually, it's hard to be very precise as the question is vague so I'll just give some pointers.
实际上,由于问题含糊不清,很难非常精确,所以我只想给出一些指示。 Have a look at solutions like:
看看像这样的解决方案:
如果这是一项大任务,你总是可以用Java或Jython编写ant任务并从ant调用它们。
This seems to be an open issue in 2017, too. 这似乎也是2017年的一个悬而未决的问题。 Searching for "java deploy script" points first to this question, and also to Ant and a few other unrelated articles.
搜索“java deploy script”首先指向这个问题,也指向Ant和其他一些不相关的文章。
The project I'm working on at the time of this writing, has 6-7 JAR files which we place in tomcat's lib/ folder, and 20-30 small WAR files that we place in webapps/. 我在撰写本文时正在研究的项目有6-7个JAR文件,我们放在tomcat的lib /文件夹中,还有20-30个小的WAR文件放在webapps /中。 We do have a deployment script that downloads from a Bamboo server and expands an archive that contains everything, but that's not usable during development.
我们有一个部署脚本,可以从Bamboo服务器下载并扩展包含所有内容的存档,但在开发期间不可用。 And deploying all these manually is a nightmare.
手动部署所有这些都是一场噩梦。
So I started my own Python script that initially would deploy several JARs and WARS to a tomcat instance. 所以我创建了自己的Python脚本,最初会将几个JAR和WARS部署到tomcat实例。
Now it's a cross-platform deployment tool (tested on Windows and Mac), and language and server agnostic, configurable via a JSON file. 现在它是一个跨平台的部署工具(在Windows和Mac上测试),语言和服务器无关,可通过JSON文件进行配置。 It can:
它可以:
Copy and delete libs and apps 复制和删除库和应用程序
Run local and remote (via SSH) commands 运行本地和远程(通过SSH)命令
Make pauses 暂停
Since you can run commands on the remote server, you can do a lot of things via Shell commands (we use them to start/stop tomcat, wait for it to start/stop, delete logs, etc.). 由于您可以在远程服务器上运行命令,因此可以通过Shell命令执行很多操作(我们使用它们来启动/停止tomcat,等待它启动/停止,删除日志等)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.