Push Local Changes

Page last updated:

Page last updated:

In this step you’ll learn how to propagate a local change to the application through to Cloud Foundry. As a simple change, we’ll modify the version returned when accessing the root endpoint /.

To do this, change the message in the static Info variable in the src/main/java/.../ProductService.class file’ to “I am awesome!”.

Now compile/build and test locally:

$ gradle build

...

$ java -jar build/libs/cf-sample-app-java-1.0.0.jar

Visiting your application at http://localhost:4567, you should receive the following response:

{
  "status": "I am awesome!",
  "version": "1.0.0",
  "appMode": null
}

Since you already have compiled and built your latest changes, you only need to push your changes to the app cloud. All you need to do is to execute cf push again:

$ cf push my-java-app -p build/libs/cf-sample-app-java-1.0.0.jar -n my-random-hostname

Finally, check that everything is working by visiting your app’s URL from your web browser.

I can push local changes
View the source for this page in GitHub