Technical Articles
Step 1 with SAP Cloud SDK: Set up
Disclaimer:
This blog post is only applicable for the latest version 2 of the SAP Cloud SDK. You can find an updated tutorial for version 3 over at our tutorial page.
In this blog post, we go through the steps required to install the SDK and corresponding tools to use it for the development of your SAP Cloud Platform application.
Note: This post is part of a series. For a complete overview visit the SAP Cloud SDK Overview.
Prepare the Infrastructure
You need to have Maven and JDK 8 installed. In case you do not have them, conduct the following steps.
Windows (Windows 7+ / Windows Server 2003+)
Execute the following steps in a command line window as administrator.
- Install Chocolatey (a package manager for Windows)
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
For more information on Chocolatey and how to use it, visit the following page.
- Install OpenJDK 8, if not yet available on your machine.
- Option 1: Get the source code from here: https://openjdk.java.net/, and build yourself.
- Option 2: Download an existing, publicly available OpenJDK 8 build, corresponding to your system. You may choose from:
- https://adoptopenjdk.net/, or
- https://jdk.java.net/8/, or
- <any other source you prefer>
(Please note that SAP shall not be responsible for any downloads from these portals).
- Install Maven
choco install maven
Mac
- Install Homebrew (Mac Packetmanager to help with the remaining installation)
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install OpenJDK 8, if not yet available on your machine.
- Option 1: Get the source code from here: https://openjdk.java.net/, and build yourself.
- Option 2: Download an existing, publicly available OpenJDK 8 build, corresponding to your system. You may choose from:
- https://adoptopenjdk.net/, or (In this case you may also use Homebrew, by running the following commands on Terminal).
brew update brew tap AdoptOpenJDK/openjdk brew cask install adoptopenjdk8
- https://jdk.java.net/8/, or
- <any other source you prefer>
- https://adoptopenjdk.net/, or (In this case you may also use Homebrew, by running the following commands on Terminal).
(Please note that SAP shall not be responsible for any downloads from these portals).
- Install Maven
brew update brew install maven
To validate that everything is installed correctly, you can use the command javac -version and mvn -version, the output should look similar to the following (you may have the newer version of the software, though):
> javac -version
javac 1.8.0_72
> mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T21:39:06+02:00)
Maven home: C:\Program Files\path\to\maven\bin\..
Java version: 1.8.0_72, vendor: Oracle Corporation
Java home: C:\Program Files\path\to\java\jdk1.8.0_72\jre
...
Check that the environment variable JAVA_HOME
points to the path of your JDK installation, e.g., C:\Program Files\path\to\java\jdk1.8.0_72
.
Install IDE
To develop your first “Hello World” application with SAP Cloud SDK, you can just use your command line and a simple text editor. However, for bigger development projects, you can work with the IDE of your choice.
We recommend to use Intellij IDEA or Eclipse. Follow the installation instructions of corresponding tools to prepare your IDE. In case you use Eclipse, make sure that the maven plugin for Eclipse is installed (this should be the case for the JavaEE edition).
Troubleshooting with Corporate Proxies
Corporate proxies cause a lot of pain for developers. Some of the steps in the upcoming tutorial blogs will fail, if you sit behind a corporate proxy. If you cannot escape the proxy, you need to tell Maven where your proxy is located.
To do this, you need to cd to your ~/.m2 directory (e.g., Windows: C:/Users/<username>/.m2) and create a file called settings.xml. Then you paste the following content.
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<proxies>
<proxy>
<id>my_corp_proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy</host>
<port>8080</port>
<username></username>
<password></password>
<nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
</proxy>
</proxies>
</settings>
After finishing these steps, you are ready to start the development of your SAP Cloud Platform applications with SAP Cloud SDK. If you are interested to learn more, stay tuned for the upcoming development topics that we will cover in the following posts: available project templates in the SDK, setting up the communication with SAP S/4HANA, deployment on Cloud Foundry, etc.
See the next tutorial in the series here: Step 2 with SAP Cloud SDK: HelloWorld on SCP Neo.
Hello
Great post.
In the product page, it is noted the sdk can be used to develop apps for S4Cloud and S4onPre.
I think the S4 server must be set in the Intellij IDEA or Eclipse options. Could you provide any step-by-step ?
What is the difference between using the S4hana Cloud SDK in Eclipse IDE and the WEBIde for sap hana included in SAP HANA DB ?
regards
Emmanuel Da Costa
Hello Emmanuel,
thanks a lot for your feedback. We are currently working on additional step by step scenarios for SAP S/4HANA Cloud SDK. You can always refer to the overview blog post for the full list of currently available tutorials. In particular, here is the blog post describing, how you can connect SAP S/4HANA and read the data via OData Service.
With regard to the WEBIde support, the topic is currently in our roadmap and we will provide more information soon, after the SDK is generally available.
Best regards,
Ekaterina
Hi Ekatarina,
Thanks for the detailed step-by-step documentation.
Under "Install IDE", could you please specify which version you recommend?
I selected "Eclipse IDE for Java Developers" but I'm not sure that's the right version.
Could you please confirm?
Hello Julien,
for the purpose of these tutorials, the mentioned addition should be sufficient.
Best regards,
Ekaterina
Thank you for the article! In my opinion, it would be good to have a little button at the end of the page linking you to the next article of the series.
Best regards,
Michael
Hi Michael, good idea, thanks for the remark! We will follow up on that with the authors.
Team,
I think I am missing a step somewhere. In the maven build process it appears to be looking at com.sap.cloud.s4hana:sdk-bom:pom:1.5.1-SNAPSHOT but in my .m2 directory I only have up to 1.1.2.
Here is in the error: "The project com.sap.opensap:cost-center-creation:1.0-SNAPSHOT (C:\dev\Proggies\Cost-Center-Creation-Neo\pom.xml) has 1 error
[ERROR] Non-resolvable import POM: Could not find artifact com.sap.cloud.s4hana:sdk-bom:pom:1.5.1-SNAPSHOT @ line 16, column 25"
Is the SDK supposed to update on its own? I have downloaded the latest SDK but it doesn't appear to be updating in the local repository which seems to be used to complete the maven clean / build operations.
Any guidance is appreciated.
Darren
Hello Darren,
we recommend to update to the version 1.7.1 of the SDK if you are working in Neo environment, see the release blog post for details. Just update the version manually in your application pom.xml and rebuild the project, the dependencies will be updated in m2 folder.
We are now regularly releasing release blogs (bi-weekly), where we write about "what is new" in the latest SDK version and how to update. Check out our Overview Blog (part "Releases") for details.
Feel free to reach out to us also in StackOverflow for questions like this (tag s4sdk), we monitor this tag very actively.
Hope this helps and best regards,
Ekaterina Kruse
Thanks Ekaterina. For those who need explicit instructions go to pom.xml and update the following:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.sap.cloud.s4hana</groupId>
<artifactId>sdk-bom</artifactId>
<version>1.7.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Then right click the pom.xml and select Run as… Maven Build
Hi Expert,
I got below error during Maven Build
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[ERROR] 'dependencies.dependency.version' for org.jboss.arquillian.junit:arquillian-junit-container:jar is missing. @ line 75, column 21
I am using 1.7.1 SDK.
thanks
Hi Vipin,
we recommend to upgrade to the newest SDK version, could you please try to execute the build with the latest version of the SDK (1.10.0)? What archetype do you use?
Also, for your information: we are maintaining the s4sdk tag in StackOverflow for the SDK related technical questions and issues, you might want to check this resource out.