npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@heroku-cli/plugin-java

v3.1.1

Published

Heroku Java CLI

Downloads

529

Readme

Heroku CLI Plugin for Java Build Status

This project is a Heroku CLI plugin for working with Java applications on Heroku. It provides commands for:

If you are using Maven, see the Heroku Maven plugin, which is a more robust method of WAR and JAR file deployment.

Prerequisites

You will require the following:

Deploying WAR files

1. Make sure Java 7 or higher is installed

Run the following command to confirm:

$ java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

2. Install this CLI plugin

$ heroku plugins:install java

3. Create a Heroku application

$ heroku create

4. Create a WAR file

You can use any method to generate a WAR file. You can use maven,ant or simply export your application from your IDE as a WAR file.

The only requirement is that the WAR file is a standard Java web application and adheres to the standard web application structure and conventions.

5. Deploy your WAR

In order to deploy your WAR use the following command:

$ heroku war:deploy <path_to_war_file> --app <app_name>
Uploading my-app.war....
---> Packaging application...
    - app: my-app
    - including: webapp-runner.jar
    - including: my-app.war
---> Creating build...
    - file: slug.tgz
    - size: 1MB
---> Uploading build...
    - success
---> Deploying...
remote:
remote: -----> Fetching custom tar buildpack... done
remote: -----> JVM Common app detected
remote: -----> Installing OpenJDK 1.8... done
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing... done, 50.3MB
remote: -----> Launching... done, v5
remote:        https://my-app.herokuapp.com/ deployed to Heroku
remote:
---> Done

If you are in an application directory, you can use the following command instead:

$ heroku deploy:war <path_to_war_file>

6. View your app on Heroku

Use the following command to open the application on the browser:

$ heroku open

You can learn how to customize the deploy (such as including files and setting Tomcat options) in Configuring WAR Deployment with the Heroku Toolbelt.

Executable JAR Files

You can also use this tool to deploy executable JAR files. To do so, run a command like this:

$ heroku jar:deploy <path_to_jar> --app <appname>

Available options include:

 -j, --jar FILE         # jar or war to deploy
 -v, --jdk VERSION      # 7 or 8. defaults to 8
 -o, --options OPTS     # options passed to the jar file
 -i, --includes FILES   # list of files to include in the slug

The --includes option may contain a list of files separated by a ; or : on Windows or Mac respectively.

Customizing your deployment

You can customize the command used to run your application by creating a Procfile in the same directory as your run the heroku jar:deploy command. For example:

web: java -cp my-uberjar.jar com.foo.MyMain opt1 opt2

You can view your current Procfile command by running heroku ps.

Running locally

You can run your WAR file locally the way it is run on Heroku by executing this command:

$ heroku war:run <path_to_war>

Inspecting a JVM on Heroku

For information on using the java commands in this plugin, see the Heroku Exec documentation.

Development

To run the tests:

$ bash bin/test

To update the lib/heroku-deploy-complete.jar:

$ bash bin/update <version>

For a list of versions see Maven Central.

To publish this plugin:

$ npm version <version>
$ npm publish

License

MIT