Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

java-buildpack

Cloud Foundry buildpack for running Java applications

Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star half bd79095782ee4930099175e5ce7f4c89fa3ddabcd56fffcc7c74f6f2a2d46b27 (1 ratings)
Rated 4.5 out of 5
Subscribe to updates I use java-buildpack


Statistics on java-buildpack

Number of watchers on Github 257
Number of open issues 25
Average time to close an issue 10 days
Main language Ruby
Average time to merge a PR 2 days
Open pull requests 20+
Closed pull requests 87+
Last commit over 1 year ago
Repo Created over 6 years ago
Repo Last Updated over 1 year ago
Size 4.48 MB
Organization / Authorcloudfoundry
Latest Releasev4.9
Contributors25
Page Updated
Do you use java-buildpack? Leave a review!
View open issues (25)
View java-buildpack activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating java-buildpack for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Cloud Foundry Java Buildpack

The java-buildpack is a Cloud Foundry buildpack for running JVM-based applications. It is designed to run many JVM-based applications (Grails, Groovy, Java Main, Play Framework, Spring Boot, and Servlet) with no additional configuration, but supports configuration of the standard components, and extension to add custom components.

Usage

To use this buildpack specify the URI of the repository when pushing an application to Cloud Foundry:

$ cf push <APP-NAME> -p <ARTIFACT> -b https://github.com/cloudfoundry/java-buildpack.git

Examples

The following are very simple examples for deploying the artifact types that we support.

Configuration and Extension

The buildpack default configuration can be overridden with an environment variable matching the configuration file you wish to override minus the .yml extension and with a prefix of JBP_CONFIG. It is not possible to add new configuration properties and properties with nil or empty values will be ignored by the buildpack (in this case you will have to extend the buildpack, see below). The value of the variable should be valid inline yaml, referred to as flow style in the yaml spec (Wikipedia has a good description of this yaml syntax). For example, to change the default version of Java to 7 and adjust the memory heuristics apply this environment variable to the application.

$ cf set-env my-application JBP_CONFIG_OPEN_JDK_JRE '{ jre: { version: 1.7.0_+ }, memory_calculator: { stack_threads: 200 } }'

If the key or value contains a special character such as : it should be escaped with double quotes. For example, to change the default repository path for the buildpack.

$ cf set-env my-application JBP_CONFIG_REPOSITORY '{ default_repository_root: "http://repo.example.io" }'

If the key or value contains an environment variable that you want to bind at runtime you need to escape it from your shell. For example, to add command line arguments containing an environment variable to a Java Main application.

$ cf set-env my-application JBP_CONFIG_JAVA_MAIN '{ arguments: "-server.port=\$PORT -foo=bar" }'

Environment variable can also be specified in the applications manifest file. For example, to specify an environment variable in an applications manifest file that disables Auto-reconfiguration.

env:
  JBP_CONFIG_SPRING_AUTO_RECONFIGURATION: '{ enabled: false }'

This final example shows how to change the version of Tomcat that is used by the buildpack with an environment variable specified in the applications manifest file.

env:
  JBP_CONFIG_TOMCAT: '{ tomcat: { version: 8.0.+ } }'

See the Environment Variables documentation for more information.

To learn how to configure various properties of the buildpack, follow the Configuration links below.

The buildpack supports 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 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. More information on extending the buildpack is available here.

Additional Documentation

Building Packages

The buildpack can be packaged up so that it can be uploaded to Cloud Foundry using the cf create-buildpack and cf update-buildpack commands. In order to create these packages, the rake package task is used.

Note that this process is not currently supported on Windows. It is possible it will work, but it is not tested, and no additional functionality has been added to make it work.

Online Package

The online package is a version of the buildpack that is as minimal as possible and is configured to connect to the network for all dependencies. This package is about 50K in size. To create the online package, run:

$ bundle install
$ bundle exec rake clean package
...
Creating build/java-buildpack-cfd6b17.zip

Offline Package

The offline package is a version of the buildpack designed to run without access to a network. It packages the latest version of each dependency (as configured in the config/ directory) and disables remote_downloads. This package is about 180M in size. To create the offline package, use the OFFLINE=true argument:

To pin the version of dependencies used by the buildpack to the ones currently resolvable use the PINNED=true argument. This will update the config/ directory to contain exact version of each dependency instead of version ranges.

$ bundle install
$ bundle exec rake clean package OFFLINE=true PINNED=true
...
Creating build/java-buildpack-offline-cfd6b17.zip

Package Versioning

Keeping track of different versions of the buildpack can be difficult. To help with this, the rake package task puts a version discriminator in the name of the created package file. The default value for this discriminator is the current Git hash (e.g. cfd6b17). To change the version when creating a package, use the VERSION=<VERSION> argument:

$ bundle install
$ bundle exec rake clean package VERSION=2.1
...
Creating build/java-buildpack-2.1.zip

Running Tests

To run the tests, do the following:

$ bundle install
$ bundle exec rake

Running Cloud Foundry locally is useful for privately testing new features.

Contributing

Pull requests are welcome; see the contributor guidelines for details.

License

This buildpack is released under version 2.0 of the Apache License.

java-buildpack open issues Ask a question     (View All Issues)
  • about 3 years AllowLinkingAppl icationContextInitializer : Unsupported major.minor version 52.0 error
  • about 3 years Buildpack can't decide how to launch my Boot app if it has a CRaSH groovy command
  • about 3 years getting exception while pushing play app to cloud foundry
  • over 3 years Tuning Glibc Environment Variables (e.g. MALLOC_ARENA_MAX)
  • over 3 years Limiting additional memory pools
  • over 3 years memory allocation issue
  • over 3 years Document how to (or implement) force HTTPS
  • over 3 years Tweak log output to highlight important messages
  • over 3 years Certain umask settings will cause build pack build script to produce a broken build pack bundle
  • over 3 years Add back the example for changing memory heuristics
  • over 3 years "user.home" system property different from $HOME environment variable
  • over 3 years ease of JCE support
  • about 4 years Consider support for auto-restaging of vulnerable droplets.TUF helpful ?
  • about 4 years Add ALPN Jar to the JVM bootclasspath
  • over 4 years killjava.sh not invoked on java.lang.OutOfMemoryError: unable to create new native thread
  • over 4 years make OnOutOfMemoryError handling configurable in java-buildpack since killing the process can cause problems for applications that don't have memory leaks
  • over 5 years Add support for triggering thread dumps and heap dumps
java-buildpack open pull requests (View All Pulls)
  • Added check to consider no_proxy env variable for offline caching
  • Add support for JVMKill agent in Java Buildpack
  • Extension point for supplying an external Tomcat configuration
  • Modified luna security provider to support minimal and full client installer
  • Add Azul Zulu as alternative jre
  • Use jvmkill agent instead of killjava script
  • AppDynamics Docs Update
  • Fix typo in space_case.rb
  • Fix typo in snake_case.rb
  • update open_jdk_jre version changed
  • Update framework-dynatrace_appmon_agent.md
  • Add a framework for the thin launcher
  • Added FusionReactor monitor support
  • Add support for binary proxies (like Artifactory/Nexus)
  • Add IBM JRE as an option to the java-buildpack
  • Overops support improvement
  • Fix multi-buildpack /bin /lib and backwards compatibility
  • Added support for Riverbed Appinternals Agent
  • add support for Tomcat internalProxies configuration
  • Add support for agentManager.credential property
java-buildpack questions on Stackoverflow (View All Questions)
  • How to add jars to the classpath of the CloudFoundry java buildpack using Java Main
  • How to combine node.js and Java buildpack in Heroku
java-buildpack list of languages used
java-buildpack latest release notes
v4.9 Java Buildpack v4.9

I'm pleased to announce the release of the java-buildpack, version 4.9. This release focuses on future Java 9 support.

For a more detailed look at the changes in 4.9, please take a look at the commit log. The packaged version of the buildpack, suitable for use with create-buildpack and update-buildpack, can be found attached to this release.

Packaged Dependencies

Dependency Version
Apache Geode Tomcat Session Store 0.0.2
AppDynamics Agent 4.3.7_2
CA Introscope APM Framework 10.6.0_0
Client Certificate Mapper 1.5.0_RELEASE
Container Security Provider 1.13.0_RELEASE
Contrast Security Agent 3.4.8_33
Dyadic EKM Security Provider 1.2.0
Dynatrace Appmon Agent 6.3.0_1305
Dynatrace OneAgent 1.131.143
Gemalto Luna Security Provider 6.2.0
Gemalto ProtectApp Security Provider 8.4.0
Google Stackdriver Debugger 2.16.0
Groovy 2.4.10
JaCoCo Agent 0.8.0
Java Memory Assistant Agent 0.3.0
Java Memory Assistant Clean Up 0.1.0
JRebel Agent 7.1.6
jvmkill Agent 1.12.0_RELEASE
MariaDB JDBC Driver 2.2.2
Memory Calculator 3.10.0_RELEASE
Metric Writer 2.3.0_RELEASE
New Relic Agent 3.47.0
OpenJDK JRE 1.8.0_162
PostgreSQL JDBC Driver 9.4.1212
Redis Session Store 1.3.6_RELEASE
Spring Auto-reconfiguration 2.3.0_RELEASE
Spring Boot CLI 1.5.10_RELEASE
Spring Boot Container Customizer 2.6.0_RELEASE
Takipi Agent 4.8.18
Tomcat 8.5.28
Tomcat Access Logging Support 3.2.0_RELEASE
Tomcat Lifecycle Support 3.2.0_RELEASE
Tomcat Logging Support 3.2.0_RELEASE
YourKit Profiler 2017.2.75
v4.8 Java Buildpack v4.8

I'm pleased to announce the release of the java-buildpack, version 4.8. This release is focused on general improvements.

  • Exponential backoff when retrying dependencies (via @stipx)
  • Add skiperror flag to Dynatrace (via @stipx)
  • Enable client certificate mapping in Tomcat applications (via Dies Koper)

For a more detailed look at the changes in 4.8, please take a look at the commit log. The packaged version of the buildpack, suitable for use with create-buildpack and update-buildpack, can be found attached to this release.

Packaged Dependencies

Dependency Version
Apache Geode Tomcat Session Store 0.0.2
AppDynamics Agent 4.4.0_3
CA Introscope APM Framework 10.5.2_15
Client Certificate Mapper 1.5.0_RELEASE
Container Security Provider 1.11.0_RELEASE
Contrast Security Agent 3.4.7_944
Dyadic EKM Security Provider 1.2.0
Dynatrace Appmon Agent 6.3.0_1305
Dynatrace OneAgent 1.131.143
Gemalto Luna Security Provider 6.2.0
Gemalto ProtectApp Security Provider 8.4.0
Google Stackdriver Debugger 2.16.0
Groovy 2.4.10
Java Memory Assistant Agent 0.3.0
Java Memory Assistant Clean Up 0.1.0
JRebel Agent 7.1.4
jvmkill Agent 1.12.0_RELEASE
MariaDB JDBC Driver 2.2.1
Memory Calculator 3.10.0_RELEASE
Metric Writer 2.3.0_RELEASE
New Relic Agent 3.46.0
OpenJDK JRE 1.8.0_162
PostgreSQL JDBC Driver 9.4.1212
Redis Session Store 1.3.6_RELEASE
Spring Auto-reconfiguration 2.3.0_RELEASE
Spring Boot CLI 1.5.9_RELEASE
Spring Boot Container Customizer 2.6.0_RELEASE
Takipi Agent 4.8.18
Tomcat 8.5.24
Tomcat Access Logging Support 3.2.0_RELEASE
Tomcat Lifecycle Support 3.2.0_RELEASE
Tomcat Logging Support 3.2.0_RELEASE
YourKit Profiler 2017.2.68
v4.7.1 Java Buildpack v4.7.1

I'm pleased to announce the release of the java-buildpack, version 4.7.1. This release is a dependency update release.

For a more detailed look at the changes in 4.7.1, please take a look at the commit log. The packaged version of the buildpack, suitable for use with create-buildpack and update-buildpack, can be found attached to this release.

Packaged Dependencies

Dependency Version
Apache Geode Tomcat Session Store 0.0.2
AppDynamics Agent 4.4.0_3
CA Introscope APM Framework 10.5.2_15
Client Certificate Mapper 1.4.0_RELEASE
Container Security Provider 1.11.0_RELEASE
Contrast Security Agent 3.4.5_884
Dyadic EKM Security Provider 1.2.0
Dynatrace Appmon Agent 6.3.0_1305
Dynatrace OneAgent 1.131.143
Gemalto Luna Security Provider 6.2.0
Gemalto ProtectApp Security Provider 8.4.0
Google Stackdriver Debugger 2.16.0
Groovy 2.4.10
Java Memory Assistant Agent 0.3.0
Java Memory Assistant Clean Up 0.1.0
JRebel Agent 7.1.3
jvmkill Agent 1.12.0_RELEASE
MariaDB JDBC Driver 2.2.0
Memory Calculator 3.10.0_RELEASE
Metric Writer 1.7.0_RELEASE
New Relic Agent 3.45.0
OpenJDK JRE 1.8.0_152
PostgreSQL JDBC Driver 9.4.1212
Redis Session Store 1.3.6_RELEASE
Spring Auto-reconfiguration 2.3.0_RELEASE
Spring Boot CLI 1.5.9_RELEASE
Spring Boot Container Customizer 2.4.0_RELEASE
Takipi Agent 4.8.18
Tomcat 8.5.24
Tomcat Access Logging Support 3.2.0_RELEASE
Tomcat Lifecycle Support 3.2.0_RELEASE
Tomcat Logging Support 3.2.0_RELEASE
YourKit Profiler 2017.2.68
Other projects in Ruby