Building Java Web Applications with Maven
Maven and the SAP HANA Cloud Platform
Since the beginning the SAP HANA Cloud Platform SDK contained Java web application samples that showed how to build them with Maven. That was somewhat cumbersome as you had to download the SDK manually and then refer to it directly via so-called system-scoped dependencies. This was significantly improved lately (see ).
From now on you can find the following artifacts for all supported Java runtimes of the SAP HANA Cloud Platform in Maven Central (the central Maven artifact repository; see ):
- Maven Plugin
Compilation of Java Web Applications
In this first part of a mini blog series on our Maven artifacts we will start with the easiest task: How to compile your Java web application against the API of the SAP HANA Cloud Platform? Well, by adding a single Maven dependency, which is the following:
Note: You may also pick neo-javaee6-wp-api for the Java EE6 Web Profile runtime.
Let me talk you through the above:
- SAP HANA Cloud Platform artifacts are published under the group ID com.sap.cloud to Maven Central. In that group ID you will find API, SDK, and Maven Plugin for all Java runtimes.
- The artifact ID specifies the combination of the Java runtime (at present neo-java-web- or neo-javaee6-wp-) and what you want to refer to (-api, -sdk, or -maven-plugin).
- The version is… well, the version of the published artifacts. Usually the SAP HANA Cloud Platform is updated every two weeks with new features and/or bug fixes. API, SDK, and Maven Plugin are released jointly and share the same version. You should pick the version you develop your Java web application for. As a side note, you can “pin” your Java web application to that version, i.e. force the SAP HANA Cloud Platform to provision exactly the runtime version you need if you want to make sure that it stays the same. If you don’t “pin”, SAP HANA Cloud Platform will always pick the latest version so that you benefit from bug fixes, especially security patches.
- Finally the scope tells Maven that the dependency shall be used only for compilation, but not be packaged with your web application. That is important as the API will actually be provided by the runtime in the cloud, hence the scope provided.
The above dependency has transitive dependencies to other dependencies that Maven will resolve automatically for you. In fact, the above dependency by itself is only about the SAP-developed API (e.g. check out our useful extensions for multi-tenancy or connecting to your firewall-protected network via the SAP Cloud Connector). The platform and the artifact makes use of Open Source components which are the above mentioned transitive dependencies automatically resolved by Maven.
The documentation (JavaDoc) of the API can be found online (see ).
In the second part of this mini blog series we will introduce the Maven Plugin for the SAP HANA Cloud Platform and tell you what you can do with it.