Deploying WAR files to Tomcat servers in different environments

We’re working on a build/deployment solution on TeamCity 8 for our java apps.  We are interested in building a WAR once, then deploying it to all envs when needed.

Build artifact:   Java WAR

Build tools:  Gradle/Maven2.

Targeted App Server: Tomcat 7

We’re currently building on TC8 using the Gradle plugins to publish/get artifacts from a local Nexus server repo (we are publishing both JARS/WARS to Nexus).  The build config also runs a Cargo metarunner step that gets the WAR file from the local checkout dir and deploys it to a remote dev Tomcat 7 server.

We’d now like a TC build config that will allow us to deploy this exact same build version to Tomcat in other environments (test through prod).  We’ve already configured a Jenkins job to get the WAR from the Nexus server and deploy it to Tomcat 7 (using Repo Connnector and Deploy to Container plugins).  Is there a similar deployment capability/plugins available within TeamCity?  We'd like to standardardize all our build and deploy jobs on TC if possible.


Comment actions Permalink

Hi Darrell

Sorry, but I'm not sure I understand the question.
You are saying you already have a build configuration in TeamCity that deploys war-artifact to Tomcat server.
Can the same procedure be used with other targets?

Comment actions Permalink

To clarify, yes, we already have a build config that will both build the war and deploy it to a targeted server in our Dev env.  
However, this process is not acceptable for the other envs, since it simply gets the war-artifact from current build's artifacts folder (via a relative path) and deploys it to Tomcat 7.  We need to be able to run a job that can retrieve this same build version from a Nexus repository server on a later date and push into test and prod envs as well.

At this point, it looks as though we simply continue to use Jenkins for deploy jobs, since it has plugins for both Nexus servers and Tomcat 7 deployments  (unless you have another suggestion).

Thanks for your support.

Comment actions Permalink


Sorry for the delay.

Though TeamCity does not have dedicated plugin for accessing Maven repository, you can use Maven runner instead.

Create Maven build step, without path to pom.xml, use following goal:


in "Additional Maven command line parameters" specify your artifact:

-DartifactId=<artifactId> -DgroupId=<groupId> -Dversion=<version> -Ddest=<relative_path_to_destination_file>

And add deployment step using downloaded file.


Please sign in to leave a comment.