Skip to Content
Author's profile photo Anthony MULLER

Enjoy SAP Cloud Platform with Eclipse (part 2/2)

In this blog, you will learn how to develop a Java application that you will publish to Cloud Foundry running in SAP Cloud Platform (SCP).

In previous blogs, you discovered how to create an free account on SCP and how connect Eclipse to your Cloud Foundry environment.


Get the source code from GitHub

To do that, I propose you to start by cloning this Git repository to your local machine. It is rather easily using Eclipse.

Firstly, open the “Git” perspective in Eclipse and then copy this URL into the clipboard:

Now, in the left panel, just paste it (CTRL+V) with Windows and Eclipse will automatically display a popup to clone the repository!

Click “Next” and on the next panel check the box “Import all existing projects ….”

Click “Finish”. Once this operation is completed, you can see on the left panel the repository tree.

Switch back to the “Java EE” perspective now and you will see the project “scphelloworld”.

Note: this project is Maven-based, so if you are not familiar with such projects yet, you can simply do a “Maven Update” (Alt+F5) to resolve any missing dependencies.


Modify and publish the application

To illustrate how to push your own application to Cloud Foundry through Eclipse, we will modify the “scphelloworld” application and deploy it.

Above all, we will remove the currently deployed application. Using Eclipse, you can right-click on the “scphelloworld” application under your server (in the “Servers” view) and choose “remove”. This will undeploy the previously application as we did in previous blogs.

Now, browse the source folder and search for the SampleController class where we will add the new URI “/bye” belong to the existing one “/hello”.

 String bye() {
     return "Bye bye!";

Ok, we will use Maven to build a new WAR file of our application. Select the project and choose “Run as… > Maven build”. Default goals “clean package” are OK.

Finally, in the “manifest.yml” file which is located in the root folder of the application, we will do a small change to avoid hostname collision (the hostname of your application have to be globally unique in the whole Cloud Foundry landscape).

So, just append your p-number at the end of the “host” property.

Right, ready to deploy your modified application? So, right-click on the “scphelloworld” application and then choose “Run As.> Run on Server”.

Select your “Cloud Foundry on SCP” server configuration you declared in the previous blog.

You will be prompted for some additional information but most of values should be OK since they are based on the “manifest.yml” file we modified.

As there is no service bindings and no specific environment variable, leave the next panels blank. And validate!

To check everything is OK with the deployment, you can simply check the new URI you added:


Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Benny Schaich-Lebek
      Benny Schaich-Lebek

      This seems to be a little outdated by now. At least you need to enhance the memory in  manifest.yml from 512M to 1024M. Then it starts.

      Unfortunately my Java knowledge does not allow me to correct the follow up Spring error message. Maybe I have more time later....