5.3.3.1. buildUberJar

buildUberJar – the task of the CubaUberJarBuilding type that creates JAR files containing the application code and all its dependencies together with embedded Jetty HTTP server. Separate JARs are created for each application block, e.g. app-core.jar for the middleware and app.jar for the web client.

The task must be declared in the root of build.gradle. The resulting JAR files are located in the build/distributions project subdirectory. See the UberJAR Deployment section for how to run the generated JAR files.

Tip

The task can be configured using the Deployment settings > Uber JAR page in Studio.

Task parameters:

  • coreJettyEnvPath - required parameter that defines a relative path to a file which contains JNDI resource definitions for Jetty HTTP server. The file must at least contain definition of a JDBC data source for the main database. Studio can generate this file on the basis of entered database connection parameters. Can also be set at run time using the -jettyEnvPath command line argument.

  • appProperties - a map defining application properties. These properties will be added to the /WEB-INF/local.app.properties files inside generated JARs.

  • corePort - port for core JAR embedded HTTP server, 8079 if not defined. Can also be set at run time using the -port command line argument.

  • webPort - port for web JAR embedded HTTP server, 8080 if not defined. Can also be set at run time using the -port command line argument.

  • portalPort - port for portal JAR embedded HTTP server, 8081 if not defined. Can also be set at run time using the -port command line argument.

  • appName - name of the application, which is app by default. You can change it for the whole project if you set Module prefix field on the Project Properties > Advanced tab in Studio, or you can set it only for the buildUberJar task using this parameter. For example:

    task buildUberJar(type: CubaUberJarBuilding) {
        coreJettyEnvPath = 'modules/core/web/META-INF/jetty-env.xml'
        appProperties = ['cuba.automaticDatabaseUpdate' : true]
        appName = 'sales'
    }

    After changing the application name to sales the task will generate sales-core.jar and sales.jar files and the web client will be available at http://localhost:8080/sales. You can also change web contexts at run time without changing the application name using the -contextName command line argument.

    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 Module prefix, appName task parameter or -frontContextName command line argument can make the Polymer UI inaccessible.

  • coreProject - a Gradle project representing the core module (Middleware). If not defined, the standard core module is used.

  • webProject - a Gradle project representing the web module (Web Client). If not defined, the standard web module is used.

  • portalProject - a Gradle project representing the portal module (Web Portal). If not defined, the standard portal module is used.

  • polymerProject - a Gradle project representing the Polymer UI module. If not defined, the standard polymer-client module is used.

  • coreWebXmlPath - a relative path to a file to be used as a web.xml for the core JAR.

  • webWebXmlPath - a relative path to a file to be used as a web.xml for the web JAR.

  • portalWebXmlPath - a relative path to a file to be used as a web.xml for the portal JAR.

  • excludeResources - a file pattern of resources to not include in JARs.

  • mergeResources - a file pattern of resources to be merged in JARs.

  • webContentExclude - a file pattern of web content to not include in web JAR.