Skip to content

Commit e4481c3

Browse files
committed
Example Documentation
Previously, all the documentation for the Java Buildpack was reference documentation. This change adds the beginnings of more by adding examples of building and deploying the artifact types that we currently support. [#63612640]
1 parent b4375fa commit e4481c3

File tree

6 files changed

+185
-0
lines changed

6 files changed

+185
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ cf push -b https://github.com/cloudfoundry/java-buildpack
1717
The following are _very_ simple examples for deploying the artifact types that we support.
1818

1919
* [Grails](docs/example-grails.md)
20+
* [Groovy](docs/example-groovy.md)
21+
* [Java Main](docs/example-java_main.md)
22+
* [Play Framework](docs/example-play_framework.md)
23+
* [Servlet](docs/example-servlet.md)
24+
* [Spring Boot CLI](docs/example-spring_boot_cli.md)
2025

2126
## Configuration and Extension
2227
The buildpack supports configuration and extension through the use of Git repository forking. The easiest way to accomplish this is to use [GitHub's forking functionality][] to create a copy of this repository. Make the required configuration and extension changes in the copy of the repository. Then specify the URL of the new repository when pushing Cloud Foundry applications. If the modifications are generally applicable to the Cloud Foundry community, please submit a [pull request][] with the changes.

docs/example-groovy.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Groovy Examples
2+
The Java Buildpack can run Groovy applications written with the [Ratpack framework][r] and from raw `.groovy` files (no pre-compilation).
3+
4+
## Raw Groovy
5+
The following example shows how deploy the sample application located in the [Java Test Applications][j].
6+
7+
```bash
8+
$ cf push -b https://github.com/cloudfoundry/java-buildpack.git
9+
-----> Downloading Open Jdk JRE 1.7.0_51 from http://.../openjdk/lucid/x86_64/openjdk-1.7.0_51.tar.gz (0.0s)
10+
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.3s)
11+
-----> Downloading Spring Auto Reconfiguration 0.8.7 from http://.../auto-reconfiguration/auto-reconfiguration-0.8.7.jar (0.0s)
12+
-----> Downloading Groovy 2.2.1 from http://.../groovy/groovy-2.2.1.zip (0.0s)
13+
Expanding Groovy to .java-buildpack/groovy (0.4s)
14+
-----> Uploading droplet (82M)
15+
16+
$ curl ...cfapps.io
17+
ok
18+
```
19+
20+
[j]: https://github.com/cloudfoundry/java-test-applications/tree/master/groovy-application
21+
[r]: http://www.ratpack.io

docs/example-java_main.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Java Main Examples
2+
The Java Buildpack can run Java applications with a `main()` method provided that they are packaged as [self-executable JARs][e].
3+
4+
## Gradle
5+
The following example shows how deploy the sample application located in the [Java Test Applications][j].
6+
7+
```bash
8+
$ gradle build
9+
$ cf push -p build/libs/java-main-application-1.0.0.BUILD-SNAPSHOT.jar -b https://github.com/cloudfoundry/java-buildpack.git
10+
11+
-----> Downloading Open Jdk JRE 1.7.0_51 from http://.../openjdk/lucid/x86_64/openjdk-1.7.0_51.tar.gz (0.0s)
12+
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.2s)
13+
-----> Downloading Spring Auto Reconfiguration 0.8.7 from http://.../auto-reconfiguration/auto-reconfiguration-0.8.7.jar (0.0s)
14+
-----> Uploading droplet (48M)
15+
16+
$ curl ...cfapps.io
17+
ok
18+
```
19+
20+
## Maven
21+
The following example shows how deploy the sample application located in the [Java Test Applications][j].
22+
23+
```bash
24+
$ mvn package
25+
$ cf push -p target/java-main-application-1.0.0.BUILD-SNAPSHOT.jar -b https://github.com/cloudfoundry/java-buildpack.git
26+
27+
-----> Downloading Open Jdk JRE 1.7.0_51 from http://.../openjdk/lucid/x86_64/openjdk-1.7.0_51.tar.gz (0.0s)
28+
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.2s)
29+
-----> Downloading Spring Auto Reconfiguration 0.8.7 from http://.../auto-reconfiguration/auto-reconfiguration-0.8.7.jar (0.0s)
30+
-----> Uploading droplet (48M)
31+
32+
$ curl ...cfapps.io
33+
ok
34+
```
35+
36+
[e]: https://github.com/cloudfoundry/java-buildpack/blob/master/docs/container-java_main.md
37+
[j]: https://github.com/cloudfoundry/java-test-applications/tree/master/java-main-application

docs/example-play_framework.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Play Framework Examples
2+
The Java Buildpack can run [Play Framework][p] applications packaged either with the `play dist` or `play stage` commands.
3+
4+
## `play dist`
5+
The following example shows how deploy the sample application located in the [Java Test Applications][j].
6+
7+
```bash
8+
$ play dist
9+
$ cf push -p target/universal/play-application-1.0-SNAPSHOT.zip -b https://github.com/cloudfoundry/java-buildpack.git
10+
11+
-----> Downloading Open Jdk JRE 1.7.0_51 from http://.../openjdk/lucid/x86_64/openjdk-1.7.0_51.tar.gz (0.0s)
12+
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.2s)
13+
-----> Downloading Play Framework Auto Reconfiguration 0.8.7 from http://.../auto-reconfiguration/auto-reconfiguration-0.8.7.jar (0.0s)
14+
-----> Downloading Spring Auto Reconfiguration 0.8.7 from http://.../auto-reconfiguration/auto-reconfiguration-0.8.7.jar (0.0s)
15+
-----> Uploading droplet (71M)
16+
17+
$ curl ...cfapps.io
18+
ok
19+
```
20+
21+
## `play stage`
22+
The following example shows how deploy the sample application located in the [Java Test Applications][j].
23+
24+
```bash
25+
$ play stage
26+
$ cf push -p target/universal/stage -b https://github.com/cloudfoundry/java-buildpack.git
27+
28+
-----> Downloading Open Jdk JRE 1.7.0_51 from http://.../openjdk/lucid/x86_64/openjdk-1.7.0_51.tar.gz (0.0s)
29+
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.2s)
30+
-----> Downloading Play Framework Auto Reconfiguration 0.8.7 from http://.../auto-reconfiguration/auto-reconfiguration-0.8.7.jar (0.0s)
31+
-----> Downloading Spring Auto Reconfiguration 0.8.7 from http://.../auto-reconfiguration/auto-reconfiguration-0.8.7.jar (0.0s)
32+
-----> Uploading droplet (71M)
33+
34+
$ curl ...cfapps.io
35+
ok
36+
```
37+
38+
[j]: https://github.com/cloudfoundry/java-test-applications/tree/master/play-application
39+
[p]: http://www.playframework.com

docs/example-servlet.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Servlet Examples
2+
The Java Buildpack can run Servlet-based applications provided that they are packaged as a WAR file.
3+
4+
## Gradle
5+
The following example shows how deploy the sample application located in the [Java Test Applications][j].
6+
7+
```bash
8+
$ gradle build
9+
$ cf push -p build/libs/web-servlet-2-application-1.0.0.BUILD-SNAPSHOT.war -b https://github.com/cloudfoundry/java-buildpack.git
10+
11+
-----> Downloading Open Jdk JRE 1.7.0_51 from http://.../openjdk/lucid/x86_64/openjdk-1.7.0_51.tar.gz (0.0s)
12+
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.1s)
13+
-----> Downloading Spring Auto Reconfiguration 0.8.7 from http://.../auto-reconfiguration/auto-reconfiguration-0.8.7.jar (0.0s)
14+
Modifying /WEB-INF/web.xml for Auto Reconfiguration
15+
-----> Downloading Tomcat 7.0.50 from http://.../tomcat/tomcat-7.0.50.tar.gz (0.0s)
16+
Expanding Tomcat to .java-buildpack/tomcat (0.1s)
17+
-----> Downloading Buildpack Tomcat Support 1.1.1 from http://.../tomcat-buildpack-support/tomcat-buildpack-support-1.1.1.jar (0.0s)
18+
-----> Uploading droplet (51M)
19+
20+
$ curl ...cfapps.io
21+
ok
22+
```
23+
24+
## Maven
25+
The following example shows how deploy the sample application located in the [Java Test Applications][j].
26+
27+
```bash
28+
$ mvn package
29+
$ cf push -p cf push -p target/web-servlet-2-application-1.0.0.BUILD-SNAPSHOT.war -b https://github.com/cloudfoundry/java-buildpack.git -b https://github.com/cloudfoundry/java-buildpack.git
30+
31+
-----> Downloading Open Jdk JRE 1.7.0_51 from http://.../openjdk/lucid/x86_64/openjdk-1.7.0_51.tar.gz (0.0s)
32+
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.1s)
33+
-----> Downloading Spring Auto Reconfiguration 0.8.7 from http://.../auto-reconfiguration/auto-reconfiguration-0.8.7.jar (0.0s)
34+
Modifying /WEB-INF/web.xml for Auto Reconfiguration
35+
-----> Downloading Tomcat 7.0.50 from http://.../tomcat/tomcat-7.0.50.tar.gz (0.0s)
36+
Expanding Tomcat to .java-buildpack/tomcat (0.1s)
37+
-----> Downloading Buildpack Tomcat Support 1.1.1 from http://.../tomcat-buildpack-support/tomcat-buildpack-support-1.1.1.jar (0.0s)
38+
-----> Uploading droplet (51M)
39+
40+
$ curl ...cfapps.io
41+
ok
42+
```
43+
44+
[j]: https://github.com/cloudfoundry/java-test-applications/tree/master/web-servlet-2-application

docs/example-spring_boot_cli.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Spring Boot CLI Examples
2+
The Java Buildpack can run [Spring Boot CLI][s] applications packaged with the `spring grab` or `spring jar` commands.
3+
4+
## `spring grab`
5+
The following example shows how deploy the sample application located in the [Java Test Applications][j].
6+
7+
```bash
8+
$ spring grab *.groovy
9+
$ $ cf push -b https://github.com/cloudfoundry/java-buildpack.git
10+
11+
-----> Downloading Open Jdk JRE 1.7.0_51 from http://.../openjdk/lucid/x86_64/openjdk-1.7.0_51.tar.gz (0.0s)
12+
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.2s)
13+
-----> Downloading Spring Auto Reconfiguration 0.8.7 from http://.../auto-reconfiguration/auto-reconfiguration-0.8.7.jar (0.0s)
14+
-----> Downloading Spring Boot CLI 1.0.0_RC2 from http://.../spring-boot-cli/spring-boot-cli-1.0.0_RC2.tar.gz (0.0s)
15+
Expanding Spring Boot CLI to .java-buildpack/spring_boot_cli (0.1s)
16+
-----> Uploading droplet (59M)
17+
18+
$ curl ...cfapps.io
19+
ok
20+
```
21+
22+
## `spring jar`
23+
The following example shows how deploy the sample application located in the [Java Test Applications][j].
24+
25+
```bash
26+
$ spring jar spring-boot-cli-application-1.0.0.BUILD-SNAPSHOT.jar *.groovy
27+
$ cf push -p spring-boot-cli-application-1.0.0.BUILD-SNAPSHOT.jar -b https://github.com/cloudfoundry/java-buildpack.git
28+
29+
-----> Downloading Open Jdk JRE 1.7.0_51 from http://.../openjdk/lucid/x86_64/openjdk-1.7.0_51.tar.gz (0.0s)
30+
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.2s)
31+
-----> Downloading Spring Auto Reconfiguration 0.8.7 from http://.../auto-reconfiguration/auto-reconfiguration-0.8.7.jar (0.0s)
32+
-----> Uploading droplet (52M)
33+
34+
$ curl ...cfapps.io
35+
ok
36+
```
37+
38+
[j]: https://github.com/cloudfoundry/java-test-applications/tree/master/spring-boot-cli-application
39+
[s]: http://projects.spring.io/spring-boot/

0 commit comments

Comments
 (0)