What would you use for deployment scripts in Java?

I am working on a Java web project that uses Maven to create its artifacts. At the end of the Maven build, we have some jar and war files that we need to deploy in our development / testing environment.

Right now we are using a pretty hefty Ant script that performs several tasks (on both Windows / Linux machines)

  • Starts / stops services
  • Copy / delete files
  • Creates material and then executes it
  • Etc

Ant works well, but the script quickly becomes very large, and frankly, it is inadequate for this task.

Are there other alternatives? I heard about gant, but I'm not sure which is the right way.

Thanks for the help!

EDIT: after further research, I found out about Gradle - it looks like a very good combination of reusing Ant tasks and allows you to run real scripts. It is worth a read.

+7
java maven-2 deployment ant
source share
4 answers

Yes, see Cargo plugin for maven:

* Deploying to a running container * Generating a container configuration deployment structure * Merging WAR files * Starting and stopping a container 

Hudson , a continuous integration mechanism, can also be used to solve these problems.

+4
source share

Deployment in general is not easy (and often very specific), and the Cargo maven plugin can help in remote deployment of war / (if remote deployment for your application server is implemented), I do not think that it will cover all your needs. In fact, it’s hard to be very precise, since the question is fuzzy, so I’ll just give a few pointers. Look for solutions such as:

+3
source share

If this is a big task, you can always write ant tasks in Java or Jython and call them from ant.

0
source share

This seems like an open-ended question in 2017. A search for "java deploy script" first points to this question, as well as to Ant and several other unrelated articles.

The project I'm working on at the time of this writing has 6-7 JAR files that we host in the tomcat lib / folder, and 20-30 small WAR files that we host in webapps /. We have a deployment script that downloads from the Bamboo server and extends the archive containing everything but not usable during development. And deploying it all manually is a nightmare.

So, I started my own Python script, which initially deployed several JARs and WARS for the tomcat instance.

Now it is a cross-platform deployment tool (tested on Windows and Mac), as well as an agnostic language and server, configured through a JSON file. He can:

  • Copy and delete libraries and applications

  • Running local and remote (via SSH) commands

  • Pause

Since you can run commands on a remote server, you can do a lot of things with Shell commands (we use them to start / stop tomcat, wait for it to start / stop, delete logs, etc.).

The deployment script is on GitHub .

0
source share

All Articles