Skip to Content
Author's profile photo Richard Hirsch

Migrating existing applications to #SAPNWCloud with Apache Maven

My goal was to use maven to deploy an existing application to NetWeaver Cloud.  SAP Research recently released a maven plug-in (on github!) that allows operational tasks for SAP NetWeaver Cloud to be performed via command line / maven. This functionality was created primarily to be used in conjunction with the Spring Roo Add-On.

I was interested in deploying a stink normal war file to NetWeaver Cloud via maven.  This sort of task might be performed by individuals interested in migrating existing applications to the NetWeaver Cloud.  The application I selected was pretty basic. It wasn’t even created via maven. It was just a war file.

Steps

  • I took the pom.xml and nwcloud.properties from an existing Spring Roo project that I had previously used to create an application for NetWeaver Cloud.  I copied both files into a new folder. I know I was lazy – the pom.xml contains a bunch of Roo / Spring Source specific code.  If you want to use an existing pom.xml and haven’t set up the nwcloud.properties file, there is a good description how to do this on the github page.
  • In the pom.xml file, I changed the following fields to my application name

<artifactId>aji</artifactId>

<packaging>war</packaging>

<version>0.1.0.BUILD-SNAPSHOT</version>

<name>aji</name>

If I didn’t reuse the pom.xml from the Spring Roo integration, then I wouldn’t have had to make these changes.

  • I created a new folder called target and copied the war file that I wanted to deploy to this folder
  • I changed the name of the war file to aji-0.1.0.BUILD-SNAPSHOT.war. If my pom.xml had already existed, then I wouldn’t have to make this change.
  • I called “mvn nwcloud:deploy nwcloud:start”
  • My application was deployed.

This was a relatively simple application that didn’t use a database, authentication, etc. If the application had additional functionality, the migration would have probably been more complicated.

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Matthias Steiner
      Matthias Steiner

      Glad to hear you had it working instantly. Matter of fact, all the samples we ship with the SDK work with Maven.

      There are samples that include persistence as well. It's quite simple in fact and you'd only need to reference additional libs if you use JPA. Then you'd need to add dependencies to the JPA API and the implementation lib e.g. EclispeLink...

      We also got samples on Github now that are using Maven. Check them out at: github.com/sapnwcloud

      Cheers,

      Matthias

      Author's profile photo Richard Hirsch
      Richard Hirsch
      Blog Post Author

      The github examples are important.

      Quick tips on how to migrate existing apps (migrate to JPA, turn on identity management, etc) would probably be useful.