6.2.4. UberJAR Deployment

This is one of the simplest ways to run your CUBA application in a production environment. You need to build all-in-one JAR files for your application blocks using the buildUberJar Gradle task (see also the Deployment settings > Uber JAR page in Studio) and then you can run the application from the command line using the java executable:

java -jar app-core.jar

java -jar app.jar

All parameters of the application are defined at the build time. The default port of the web client is 8080 and it will try to connect to the middleware running on localhost:8079. So after running the above commands in two separate terminal windows you will be able to connect to the web client at http://localhost:8080/app. If your project has Polymer UI, it will be available at http://localhost:8080/app-front.

You can change the parameters defined at the build time by providing application properties via Java system properties. Besides, ports and context names can be provided as command line arguments.

Command line arguments:

  • port - defines the port on which the embedded HTTP server will run. For example:

    java -jar app.jar -port 9090

    Please note that if you specify a port for the core block, you need to provide the cuba.connectionUrlList application property with the corresponding address to the client blocks, for example:

    java -jar app-core.jar -port 7070
    
    java -jar -Dcuba.connectionUrlList=http://localhost:7070/app-core app.jar
  • contextName - a web context name for this application block. For example, in order to access your web client at http://localhost:8080/sales, run the following command:

    java -jar app.jar -contextName sales
  • frontContextName - a web context name for the Polymer UI running in the web or portal client block.

    Warning

    Please note that current implementation of Polymer UI requires manual setting of <base> tag to the actual web context available at run time. So changing the context by using -frontContextName command line argument can make the Polymer UI inaccessible.

  • jettyEnvPath - a path to the Jetty environment file. It can be an absolute path or a path relative to the working directory.