The Apache Tomee Buildpack is a Cloud Native Buildpack that contributes Apache Tomee and Process Types for WARs.
This buildpack will participate all the following conditions are met
<APPLICATION_ROOT>/WEB-INFexistsMain-Classis NOT defined in the manifestBP_JAVA_APP_SERVERis set totomee
The buildpack will do the following:
- Requests that a JRE be installed
- Contribute a Tomee instance to
$CATALINA_HOME - Contribute a Tomee instance to
$CATALINA_BASE- Contribute
context.xml,logging.properties,server.xml, andweb.xmltoconf/ - Contribute Access Logging Support, Lifecycle Support, and Logging Support
- Contribute external configuration if available
- Contribute
- Contributes
tomee,task, andwebprocess types
When this buildpack runs on the Tiny stack, which has no shell, the following notes apply:
- As there is no shell, the
catalina.shscript cannot be used to start Tomee - The Tomee Buildpack will generate a start command directly. It does not support all the functionality in
catalina.sh. - Some configuration options such as
bin/setenv.shand settingCATALINA_*environment variables, will not be available. - Tomee will be run with
umaskset to0022instead of thecatalina.shprovided default of0027
| Environment Variable | Description |
|---|---|
$BP_JAVA_APP_SERVER |
The application server to use. It defaults to the empty string, which allow the first Java application server in the buildpack order group to run. It can be set to tomee to force Tomee to be used. See the documentation for other Java application server buildpacks for other acceptable values. |
$BP_TOMEE_CONTEXT_PATH |
The context path to mount the application at. Defaults to empty (ROOT). |
$BP_TOMEE_ENV_PROPERTY_SOURCE_DISABLED |
When true the buildpack will not configure org.apache.tomcat.util.digester.EnvironmentPropertySource. This configuration option is added to support loading configuration from environment variables and referencing them in Tomcat configuration files. |
$BP_TOMEE_EXT_CONF_SHA256 |
The SHA256 hash of the external configuration package |
$BP_TOMEE_EXT_CONF_STRIP |
The number of directory levels to strip from the external configuration package. Defaults to 0. |
$BP_TOMEE_EXT_CONF_URI |
The download URI of the external configuration package |
$BP_TOMEE_EXT_CONF_VERSION |
The version of the external configuration package |
$BP_TOMEE_VERSION |
Configure a specific Tomee version. This value must exactly match a version available in the buildpack so typically it would configured to a wildcard such as 10.*. |
$BP_TOMEE_DISTRIBUTION |
Configure a specific Tomee distribution. This value must be one of microprofile, webprofile, plus or plume. Defaults to microprofile. |
$BPL_TOMEE_ACCESS_LOGGING_ENABLED |
Whether access logging should be activated. Defaults to inactive. |
BPI_TOMCAT_ADDITIONAL_JARS |
This should only be used in other buildpacks to include a jar to the tomcat classpath. Several jars must be separated by :. |
BPI_TOMCAT_ADDITIONAL_COMMON_JARS |
This should be used by other buildpacks to include additional locations to be class loaded by the tomcat common classloader. For example a buildpack might contribute resources in its dedicated layer and add the location with this variable to be classloaded additionally by Tomcat. Both folder paths as well as single jar file paths can be specified. |
The artifacts that the repository provides must be in TAR format and must follow the Tomee archive structure:
<CATALINA_BASE>
└── conf
├── context.xml
├── server.xml
├── web.xml
├── ...
When the Environment Property Source is configured, configuration for Tomcats configuration files can be loaded from environment variables. To use this feature, the name of the environment variable must match the name of the property.
The buildpack optionally accepts the following bindings:
Buildpacks can contribute JARs to the CLASSPATH of Tomcat by appending a path to BPI_TOMCAT_ADDITIONAL_JARS.
func (s) Contribute(layer libcnb.Layer) (libcnb.Layer, error) {
// Copy dependency into the layer
file := filepath.Join(layer.Path, filepath.Base(s.Dependency.URI))
layer, err := s.LayerContributor.Contribute(layer, func(artifact *os.File) (libcnb.Layer, error) {
if err := sherpa.CopyFile(artifact, file); err != nil {
return libcnb.Layer{}, fmt.Errorf("unable to copy artifact to %s\n%w", file, err)
}
return layer, nil
})
additionalJars := []string{file}
// Add dependency to BPI_TOMCAT_ADDITIONAL_JARS
layer.LaunchEnvironment.Append("BPI_TOMCAT_ADDITIONAL_JARS", ":", strings.Join(additionalJars, ":"))
return layer, nil
}| Key | Value | Description |
|---|---|---|
<dependency-digest> |
<uri> |
If needed, the buildpack will fetch the dependency with digest <dependency-digest> from <uri> |
This buildpack is released under version 2.0 of the Apache License.