|
7 | 7 |
|
8 | 8 | [cf]: http://www.cloudfoundry.com |
9 | 9 |
|
10 | | - |
11 | | -# Configuration |
12 | | -The buildpack allows you to configure the both the vendor and version of the Java runtime your application should use. To configure these, you can either put a `system.properties` file into your pushed artifact, or specify environment variables for your application. By default the **OpenJDK 7** Java runtime is chosen. |
| 10 | +# Buildpack Users |
| 11 | +The buildpack allows you to configure the both the vendor and version of the Java runtime your application should use. To configure these, you can put a `system.properties` file into your pushed artifact. |
13 | 12 |
|
14 | 13 | ## `system.properties` |
15 | 14 | If a `system.properties` file exists anywhere within your artifact's filesystem and the following properties have been set, they will be read and used to select the Java runtime for your application: |
16 | 15 |
|
17 | | -| Name | Description |
| 16 | +| Name | Description |
18 | 17 | | ---- | ----------- |
19 | | -| `java.runtime.vendor` | The vendor of the Java runtime to use. Legal values are `oracle` or `openjdk`. |
20 | | -| `java.runtime.version` | The version of the Java runtime to use. The legal values are dependent on the vendor, but are typically `6`, `7`, `8`, `1.6`, `1.7`, and `1.8` are acceptable. |
| 18 | +| `java.runtime.vendor` | The vendor of the Java runtime to use. The legal values are defined by the keys in [`config/jres.yml`][jres_yml]. |
| 19 | +| `java.runtime.version` | The version of the Java runtime to use. The legal values are defined by the keys in [`index.yml`][index_yml] |
21 | 20 |
|
22 | 21 | An example `system.properties` file would to contain the following: |
23 | 22 | ```java |
24 | 23 | java.runtime.vendor=openjdk |
25 | | -java.runtime.version=8 |
| 24 | +java.runtime.version=1.7.0_21 |
26 | 25 | ``` |
| 26 | +## JRE Version Syntax and Ordering |
| 27 | +JREs versions are composed of major, minor, micro, and optional qualifier parts (`<major>.<minor>.<micro>[_<qualifier>]`). The major, minor, and micro parts must be numeric. The qualifier part is composed of letters, digits, and hyphens. The lexical ordering of the qualifier is: |
27 | 28 |
|
28 | | -## Environment Variables |
29 | | -If the following environment variables have been set, they will be read and used to select the Java runtime for your application: |
| 29 | +1. hyphen |
| 30 | +2. lowercase letters |
| 31 | +3. uppercase letters |
| 32 | +4. digits |
30 | 33 |
|
31 | | -| Name | Description |
32 | | -| ---- | ----------- |
33 | | -| `JAVA_RUNTIME_VENDOR` | The vendor of the Java runtime to use. Legal values are `oracle` or `openjdk`. |
34 | | -| `JAVA_RUNTIME_VERSION` | The version of the Java runtime to use. The legal values are dependent on the vendor, but are typically `6`, `7`, `8`, `1.6`, `1.7`, and `1.8` are acceptable. |
| 34 | +## JRE Version Wildcards |
| 35 | +In addition to declaring a specific version of JRE to use, you can also specify a bounded range of JRES to use. Appending the `+` symbol to a version prefix chooses the latest JRE that begins with the prefix. |
| 36 | + |
| 37 | +| Example | Description |
| 38 | +| ------- | ----------- |
| 39 | +| `1.+` | Selects the greatest available version less than `2.0.0`. |
| 40 | +| `1.7.+` | Selects the greatest available version less than `1.8.0`. |
| 41 | +| `1.7.0_+` | Selects the greatest available version less than `1.7.1`. Use this syntax to stay up to date with the latest security releases in a particular version. |
| 42 | + |
| 43 | +## Default JRE |
| 44 | +If the user does not specify a JRE vendor and version, a JRE is selected automatically. The selection algorithm is as follows: |
| 45 | + |
| 46 | +1. If a single vendor is available, it is selected. If zero or more than one vendor is available, the buildpack will fail. |
| 47 | +2. The latest version of JRE for the selected vendor is chosen. |
| 48 | + |
| 49 | +[jres_yml]: config/jres.yml |
| 50 | +[index_yml]: http://jres.gopivotal.com.s3.amazonaws.com/lucid/x86_64/openjdk/index.yml |
| 51 | + |
| 52 | + |
| 53 | +# Buildpack Developers |
| 54 | +This buildpacks is designed to be extensible by other developers. To this end, various bits of configuration are exposed that make it simple to add functionality. |
| 55 | + |
| 56 | +## Adding JRES |
| 57 | +By default, this buildpack only allows users to choose from [OpenJDK][openjdk] JREs. To allow users to choose a JRE from other vendors, these vendors must be specified in [`config/jres.yml`][jres_yml]. The file is [YAML][yaml] formatted with the following syntax: |
35 | 58 |
|
36 | | -To set these properties for your application, do the following: |
37 | 59 | ```plain |
38 | | -cf set-env my-app JAVA_RUNTIME_VENDOR openjdk |
39 | | -cf set-env my-app JAVA_RUNTIME_VERSION 8 |
| 60 | +<vendor name>: <JRE repository root URI> |
40 | 61 | ``` |
| 62 | + |
| 63 | +The JRE repository root must contain a `/index.yml` file ([example][index_yml]). This file is also [YAML][yaml] formatted with the following syntax: |
| 64 | + |
| 65 | +```plain |
| 66 | +<JRE version>: <path relative to JRE repository root> |
| 67 | +``` |
| 68 | + |
| 69 | +The JRES uploaded to the repository must be gzipped TAR files and have no top-level directory ([example][example_jre]). |
| 70 | + |
| 71 | +An example filesystem might look like: |
| 72 | + |
| 73 | +```plain |
| 74 | +/index.yml |
| 75 | +/openjdk-1.6.0_27.tar.gz |
| 76 | +/openjdk-1.7.0_21.tar.gz |
| 77 | +/openjdk-1.8.0_M7.tar.gz |
| 78 | +``` |
| 79 | + |
| 80 | +[openjdk]: http://openjdk.java.net |
| 81 | +[yaml]: http://www.yaml.org |
| 82 | +[example_jre]: http://jres.gopivotal.com.s3.amazonaws.com/lucid/x86_64/openjdk/openjdk-1.8.0_M7.tar.gz |
0 commit comments