Chapter 4. Reference

4.1. Source-to-Image (S2I)

The Red Hat JBoss Web Server for OpenShift image includes S2I scripts and Maven.

4.1.1. Using maven artifact repository mirrors with JWS for OpenShift

A Maven repository holds build artifacts and dependencies, such as the project jars, library jars, plugins or any other project specific artifacts. It also defines locations to download artifacts from while performing the S2I build. Along with using the Maven Central Repository, some organizations also deploy a local custom repository (mirror).

Benefits of using a local mirror are:

  • Availability of a synchronized mirror, which is geographically closer and faster.
  • Greater control over the repository content.
  • Possibility to share artifacts across different teams (developers, CI), without the need to rely on public servers and repositories.
  • Improved build times.

A Maven repository manager can serve as local cache to a mirror. Assuming that the repository manager is already deployed and reachable externally at, the S2I build can use this repository. To use an internal Maven repository, add the MAVEN_MIRROR_URL environment variable to the build configuration of the application.

For a new build configuration, use the --build-env option with oc new-app or oc new-build:

$ oc new-app \ \
 --image-stream=jboss-webserver31-tomcat8-openshift \
 --context-dir='tomcat-websocket-chat' \
 --build-env MAVEN_MIRROR_URL= \

For an existing build configuration:

  1. Identify the build configuration which requires the MAVEN_MIRROR_URL variable:

    $ oc get bc -o name
  2. Add the MAVEN_MIRROR_URL environment variable to buildconfig/jws:

    $ oc env bc/jws MAVEN_MIRROR_URL=""
    buildconfig "jws" updated
  3. Verify the build configuration has updated:

    $ oc env bc/jws --list
    # buildconfigs jws
  4. Schedule a new build of the application using oc start-build

During application build, Maven dependencies are download from the repository manager, instead of the default public repositories. Once the build has finished, the mirror contains all the dependencies retrieved and used during the build.

4.1.2. Scripts included on the Red Hat JBoss Web Server for OpenShift image

runs Catalina (Tomcat)
uses Maven to build the source, create package (.war) and move it to the $JWS_HOME/webapps directory.

4.1.3. JWS for OpenShift compatible environment variables

The build configuration can be modified by including environment variables to the Source-to-Image build command (see Section 4.1.1, “Using maven artifact repository mirrors with JWS for OpenShift”). The valid environment variables for the Red Hat JBoss Web Server for OpenShift images are:

Variable NameDescriptionExample Value :leveloffset: +3


.war, .ear, and .jar files from this directory will be copied into the deployments directory.



Hostname or IP address of a HTTP proxy for Maven to use.


TCP Port of a HTTP proxy for Maven to use.



If supplied with HTTP_PROXY_PASSWORD, use credentials for HTTP proxy.



If supplied with HTTP_PROXY_USERNAME, use credentials for HTTP proxy.



If supplied, a configured HTTP proxy will ignore these hosts (a comma-separated lists of hosts, IP addresses or domains).



Overrides the arguments supplied to Maven during build.

-e -Popenshift -DskipTests -Dcom.redhat.xpaas.repo.redhatga package


Appends user arguments supplied to Maven during build.



URL of a Maven mirror/repository manager to configure.


Optionally clear the local Maven repository after the build.


:leveloffset: 3

4.2. Valves on JWS for OpenShift

4.2.1. JWS for OpenShift compatible environmental variables (valve component)

You can define the following environment variables to insert the valve component into the request processing pipeline for the associated Catalina container.

Variable NameDescriptionExample ValueDefault Value


Enable the Access Log Valve to log access messages to the standard output channel.



4.3. Checking Logs

To view the OpenShift logs or the logs provided by a running container’s console:

$ oc logs -f <pod_name> <container_name>

Access logs are stored in /opt/webserver/logs/.