Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
matt_steiner
Active Contributor


As stated in the first post of my "Essentials" series it's all about lowering the entry barrier and helping newbies to get started with SAP Cloud Platform. So, in this blog post I quickly want to provide you with the 'bare necessities' to install the required tooling for Git and Maven for Eclipse in order to simplify the process of getting examples from social code sharing sites such as Github up and running.

Note: Please do not expect me to provide you with the ultimate beginners guide to the stated technologies! By no means do I want give impression that I'll serve you all you need to know on a silver plate. You'd certainly be well-advised to familiarize yourself with these tools IF you want to stay in control of what you're doing! All I want to achieve with this post is to help you with getting your setup right in just a few minutes - establishing a basecamp if you will - you still have to climb the rest of the mountain yourself though. :wink:


Installing EGit


Alright, in order to install the Git plugin for Eclipse (called EGit) you would need to do the following steps:

  1. In Eclipse, goto "Help > Install New Software..."

  2. Depending on which version of Eclipse you use (we currently support Juno and Indigo) you have to select the corresponding Update Site from the drop-down box

  3. Select the plugins/features checked in the following screenshot under the "Collaboration" node



Installing Maven for Eclipse


Now that we got EGit installed, we want to add Maven support: m2e-wtp. That may sound a bit cryptic (gotta love developers, right!), so let's explain: it's a Maven plugin for Eclipse that allows to use Maven-based projects in conjunction with the Web Tools Platform (WTP).

  1. Again, goto "Help > Install New Software..."

  2. Enter "http://download.eclipse.org/m2e-wtp/releases/" in the drop-down box and click "Add"

  3. Select the plugins/features checked in the screenshot below:



EGit configuration


Next thing we do is to configure EGit. For that we have to perform the following steps:

  1. Goto "Preferences"

  2. Enter "Git" in the filter field in the top-left corner

  3. Select the "Configuration" node

  4. Copy & adjust the settings shown below as they match your environment (proxy, email, etc.)




Maven configuration


Last remaining step is to configure Maven. It's simple:

  1. Goto "Preferences"

  2. Enter "Maven" in the filter field in the top-left corner

  3. Select the "Installations" node

  4. If you already haven Maven installed you want to point to a (global) pre-existing settings file. If not, you may want to create a settings.xml file and point to it here, e.g. if you want ... aeh need to specifiy a proxy server etc.


So, that's pretty much it... you may want to check that it all works fine by cloning one of the SAP Cloud Platform samples on Github. Let's do it together...

Cloning a git repo(sitory)


So, let's got to one of the easier samples on our Github account:

https://github.com/SAP/cloud-springrest 



Copy the URL to the repo (https://github.com/SAP/cloud-springrest.git) by clicking the little notepad icon. (Note: As you can see from the screenshot I've been logged on with my Github user and as I'm a contributor to this project I have both Read + Write access.)

Now, let's go back to Eclipse and open the Git perspective via the "Windows > Open Perspective > Other..." menu entry and the selecting the "Git Repository Exploring" option. In this perspective you have the "Git Repositories" view on the left. In the corresponding menu (top-right of the view), click on the "Clone Git repository and add the clone to this view" icon.

In the pop-up window, select "URI" as the repository source. Click next to get to the next step of the wizard. Here, all the details should already be pre-filled (if you have used the notepad button on Github!) If you should have a Github user and you do want to contribute to the respective repo, you may want to maintain your username/password in the authentication section at the bottom. But cloning the repo should equally well work without it. Press "Next" and skip over the next wizard step - there is no need to make any changes. On the third and last page, select the directory to clone this repo to. In general, it's a good idea to store all your git repositories in a dedicated folder. Click on "Finish" to clone the repository.



Let's switch to the "Java EE" perspective and use the "File > Import..." menu and then the "Existing Maven projects" option. Provide the link to the root directory and click on Finish. Now, the project sources should be imported into your workspace. We're almost there...

Open up the project properties by using the context-menu of the project in the "Project Explorer" view. Select 'Properties' and then "Project Facets". here, you need to convert the project to faceted form (This is an Eclipse-specific setting and hence - by design - not part of the Maven project nor the project repo.) Once this has happened you should see a "Dynamic Web Module" Facet being active. Select it. On the right hand side you should see a "Details/Runtimes" toggle. Switch to the "Runtimes" option and select "SAP Cloud Platform" as the designated runtime.

Last thing you need to do is to use the context.menu of the project to trigger the build by using the "Run As > Maven install" option. Once the build has ended successfully you can add the project to a local or remote server as you would do with non-Maven projects....

Hope this blog post is useful to some of you... let me know about your experiences (good AND bad!)


[UPDATE:] This blog post was updated on January 25th 2018 to fix some broken links and to adjust product names etc.
11 Comments