{"id":13716365,"url":"https://github.com/heroku/heroku-buildpack-java","last_synced_at":"2025-05-07T05:32:43.298Z","repository":{"id":1543064,"uuid":"1866890","full_name":"heroku/heroku-buildpack-java","owner":"heroku","description":"Heroku's classic buildpack for Java applications.","archived":false,"fork":false,"pushed_at":"2025-05-05T13:33:54.000Z","size":1014,"stargazers_count":168,"open_issues_count":5,"forks_count":441,"subscribers_count":98,"default_branch":"main","last_synced_at":"2025-05-05T14:47:59.988Z","etag":null,"topics":["buildpack","heroku","heroku-languages","java"],"latest_commit_sha":null,"homepage":"https://devcenter.heroku.com/categories/java-support","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heroku.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2011-06-08T18:27:32.000Z","updated_at":"2025-04-03T14:13:01.000Z","dependencies_parsed_at":"2023-02-19T17:45:57.356Z","dependency_job_id":"ee91429a-9d8b-4154-8194-cf13954d4e2e","html_url":"https://github.com/heroku/heroku-buildpack-java","commit_stats":{"total_commits":597,"total_committers":33,"mean_commits":18.09090909090909,"dds":"0.37018425460636517","last_synced_commit":"88c94d18bbe26c4a37bba8ab2c6dd174a9cbe395"},"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heroku%2Fheroku-buildpack-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heroku%2Fheroku-buildpack-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heroku%2Fheroku-buildpack-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heroku%2Fheroku-buildpack-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heroku","download_url":"https://codeload.github.com/heroku/heroku-buildpack-java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252823312,"owners_count":21809704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["buildpack","heroku","heroku-languages","java"],"created_at":"2024-08-03T00:01:09.758Z","updated_at":"2025-05-07T05:32:42.775Z","avatar_url":"https://github.com/heroku.png","language":"Ruby","readme":"Heroku buildpack for Java [![CI](https://github.com/heroku/heroku-buildpack-java/actions/workflows/ci.yml/badge.svg)](https://github.com/heroku/heroku-buildpack-java/actions/workflows/ci.yml)\n=========================\n\n![java](https://cloud.githubusercontent.com/assets/871315/20325947/f3544014-ab43-11e6-9c51-8240ce161939.png)\n\nThis is the official [Heroku buildpack](http://devcenter.heroku.com/articles/buildpack) for Java apps.\nIt uses Maven 3.9.4 to build your application and OpenJDK 8 to run it. However, the JDK version can be configured as described below.\n\n## How it works\n\nThe buildpack will detect your app as Java if it has a `pom.xml` file, or one of the other POM formats supports by the [Maven Polyglot](https://github.com/takari/polyglot-maven) plugin, in its root directory.  It will use Maven to execute the build defined by your `pom.xml` and download your dependencies. The `.m2` folder (local maven repository) will be cached between builds for faster dependency resolution. However neither the `mvn` executable nor the `.m2` folder will be available in your slug at runtime.\n\n## Documentation\n\nFor more information about using Java and buildpacks on Heroku, see these Dev Center articles:\n\n*  [Heroku Java Support](https://devcenter.heroku.com/articles/java-support)\n*  [Introduction to Heroku for Java Developers](https://devcenter.heroku.com/articles/intro-for-java-developers)\n*  [Deploying Tomcat-based Java Web Applications with Webapp Runner](https://devcenter.heroku.com/articles/java-webapp-runner)\n*  [Deploy a Java Web Application that launches with Jetty Runner](https://devcenter.heroku.com/articles/deploy-a-java-web-application-that-launches-with-jetty-runner)\n*  [Using a Custom Maven Settings File](https://devcenter.heroku.com/articles/using-a-custom-maven-settings-xml)\n*  [Using Grunt with Java and Maven to Automate JavaScript Tasks](https://devcenter.heroku.com/articles/using-grunt-with-java-and-maven-to-automate-javascript-tasks)\n\n## Examples\n\n* [Tomcat Webapp-Runner Example](https://github.com/kissaten/webapp-runner-minimal)\n* [Spring Boot Example](https://github.com/kissaten/spring-boot-heroku-demo)\n\n## Configuration\n\n### Choose a JDK\n\nCreate a `system.properties` file in the root of your project directory and set `java.runtime.version=1.8`.\n\nExample:\n\n    $ ls\n    Procfile pom.xml src\n\n    $ echo \"java.runtime.version=1.8\" \u003e system.properties\n\n    $ git add system.properties \u0026\u0026 git commit -m \"Java 8\"\n\n    $ git push heroku main\n    ...\n    -----\u003e Java app detected\n    -----\u003e Installing OpenJDK 1.8... done\n    -----\u003e Installing Maven 3.3.3... done\n    ...\n\n### Choose a Maven Version\n\nYou can define a specific version of Maven for Heroku to use by adding the\n[Maven Wrapper](https://github.com/takari/maven-wrapper) to your project. When\nthis buildpack detects the presence of a `mvnw` script and a `.mvn` directory,\nit will run the Maven Wrapper instead of the default `mvn` command.\n\nIf you need to override this, the `system.properties` file also allows for a `maven.version` entry\n(regardless of whether you specify a `java.runtime.version` entry). For example:\n\n```\njava.runtime.version=1.8\nmaven.version=3.3.9\n```\n\n### Customize Maven\n\nThere are three config variables that can be used to customize the Maven execution:\n\n+ `MAVEN_CUSTOM_GOALS`: set to `clean dependency:list install` by default\n+ `MAVEN_CUSTOM_OPTS`: set to `-DskipTests` by default\n+ `MAVEN_JAVA_OPTS`: set to `-Xmx1024m` by default\n\nThese variables can be set like this:\n\n```sh-session\n$ heroku config:set MAVEN_CUSTOM_GOALS=\"clean package\"\n$ heroku config:set MAVEN_CUSTOM_OPTS=\"--update-snapshots -DskipTests=true\"\n$ heroku config:set MAVEN_JAVA_OPTS=\"-Xss2g\"\n```\n\nOther options are available for [defining a custom `settings.xml` file](https://devcenter.heroku.com/articles/using-a-custom-maven-settings-xml).\n\n## Development\n\nTo make changes to this buildpack, fork it on Github. Push up changes to your fork, then create a new Heroku app to test it, or configure an existing app to use your buildpack:\n\n```\n# Create a new Heroku app that uses your buildpack\nheroku create --buildpack \u003cyour-github-url\u003e\n\n# Configure an existing Heroku app to use your buildpack\nheroku buildpacks:set \u003cyour-github-url\u003e\n\n# You can also use a git branch!\nheroku buildpacks:set \u003cyour-github-url\u003e#your-branch\n```\n\nFor example if you want to have Maven available to use at runtime in your application, you can copy it from the cache directory to the build directory by adding the following lines to the compile script:\n\n    for DIR in \".m2\" \".maven\" ; do\n      cp -r $CACHE_DIR/$DIR $BUILD_DIR/$DIR\n    done\n\nThis will copy the local Maven repo and Maven binaries into your slug.\n\nCommit and push the changes to your buildpack to your GitHub fork, then push your sample app to Heroku to test. Once the push succeeds you should be able to run:\n\n    $ heroku run bash\n\nand then:\n\n    $ ls -al\n\nand you'll see the `.m2` and `.maven` directories are now present in your slug.\n\nLicense\n-------\n\nLicensed under the MIT License. See LICENSE file.\n","funding_links":[],"categories":["[Heroku Buildpacks](https://devcenter.heroku.com/)"],"sub_categories":["Provides buildpacks for:"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheroku%2Fheroku-buildpack-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheroku%2Fheroku-buildpack-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheroku%2Fheroku-buildpack-java/lists"}