Java War/Ear deployment

Clever Cloud allows you to run WAR or EAR applications. You can deploy these projects without changing your code. We just need a configuration file with your targeted container.

Note : like other runtimes, Java application need listen on


In JEE, application modules are packaged as EAR and WAR based on their functionality.

  • WAR: Web modules which contains Servlet class files, JSP FIles, supporting files, GIF and HTML files are packaged as JAR file with .war extension.

  • EAR: .war and .jar files are packaged as JAR file with .ear extension and deployed into Application Server. EAR file contains configuration such as application security role mapping, EJB reference mapping and context root url mapping of web modules.

Available containers

Clever Cloud supports many servlet containers. The supported containers are listed below:

Apache Jetty Jboss Glassfish Payara Resin Wildfly
Apache Tomcat 4.1 (TOMCAT4)Jetty 6.1 (JETTY6)Jboss 6.1 (JBOSS6)Glassfish 3.1 (GLASSFISH3)Payara 4.1 (PAYARA4)Resin 3.1 (RESIN3)WildFly 9.0.2 (WILDFLY9)
Apache Tomcat 5.5 (TOMCAT5)Jetty 7.6 (JETTY7)Jboss AS 7.1 (JBOSS7)Glassfish 4.1 (GLASSFISH4)
Apache Tomcat 6.0 (TOMCAT6)Jetty 8.1 (JETTY8)
Apache Tomcat 7.0 (TOMCAT7)Jetty 9.0 (JETTY9)
Apache Tomcat 8.8 (TOMCAT8)

Available Java versions

Please refer to Java: select version

Create an application

Refer to the page Deploy an application on Clever Cloud.

Configure your application


You must provide a clevercloud/war.json file in your application repository.

Full configuration example.

Here's what your configuration file can look like:

   "build": {
      "type": "maven",
      "goal": "package"
   "deploy": {
      "container": "TOMCAT8",
      "war": [
            "file": "target/my-app-1.0-SNAPSHOT.war",
            "context": "/app1",
            "checkMe": "/app1/ping"
            "file": "my-second-app.war",
            "context": "/app2",
            "checkMe": "/app2/web/foobar"

Ok, but what does all this configuration mean?

Let's start with the mandatory part:

      "war" : [
Usage Field Description
Required container Name of the container to use. Should contain one of the values inside parentheses in the containers table (in uppercase and all).
Required file Should contain the path of the war/ear file relative to your application root.
Optional context
  • Must start with a slash (/), can be "/".
  • Defines the base path you want your app to be under. If your app has a /foobar endpoint, it will be available under the /{my-context}/foobar path.
  • Not needed for an ear file.
  • The default value for a war is the name of the war without the extensions: helloworld-1.0.war will be deployed under the /helloworld-1.0 context.
Optional checkMe
  • This field is recommended
  • A path to GET in order to test if the application is really running.
  • By default we will consider that the application is up if the container is up.
  • With this option, we will try to GET /{checkMe} for each one of your wars and consider the app down until every single checkMe path that replies a 200.

Build your application on Clever Cloud

The mandatory part alone is enough… if you directly push a dry war file to deploy. You might want to just push your code to Clever Cloud and let us build the app and generate the war.

That you can do, by setting the "build" field object in the war.json file:

  "build": {
    "type": "<string>",
    "goal": "<string>"
Usage Field Description
Required type
  • The tool you want to use to build your app
  • Can be "maven", "gradle", "sbt" or "ant"
Required goal
  • The goal you want the tool to execute.
  • Basically, for maven, you want to put "package" in here.

More configuration

Need more configuration? To run a script at the end of your deployment? To add your private SSH key to access private dependencies? Go check the Common configuration page.

Available containers

Here's the list of the configuration values for the "container" field in war.json:

Value Description
GLASSFISH3 Use Glassfish 3.x (see
GLASSFISH4 Use Glassfish 4.x (see
JBOSS6 Use JBoss AS 6.x (see
JBOSS7 Use JBoss AS 7.x (see
RESIN3 Use Resin AS 3.x (see
RESIN4 Use Resin AS 4.x (see
JETTY6 Use Jetty servlet container 6.x (see
JETTY7 Use Jetty servlet container 7.x (see
JETTY8 Use Jetty servlet container 8.x (see
JETTY9 Use Jetty servlet container 9.x (see
TOMCAT4 Use Tomcat servlet container 4.x (see
TOMCAT5 Use Tomcat servlet container 5.x (see
TOMCAT6 Use Tomcat servlet container 6.x (see
TOMCAT7 Use Tomcat servlet container 7.x (see
TOMCAT8 Use Tomcat servlet container 8.x (see
PAYARA4 Use Payara servlet container 4.x (see
WILDFLY9 Use Wildfly servlet container 9.x (see

Environment injection

Clever Cloud can inject environment variables that are defined in the dashboard and by add-ons linked to your application.

For WAR/EAR applications, the environment is injected in the System.getProperties() object. So, to use a variable, you just do System.getProperties().getProperty("MY_VARIABLE").

Deploy on Clever Cloud

Application deployment on Clever Cloud is via Git. Follow these steps to deploy your application.

Edit me on GitHub