Update 19 Feb 2016: Additional configuration entry when using EGit with online repositories.

Introduction

Java developments are becoming more common as PI/PO moves to single Java-only stack. Pure Java mappings and adapter module developments are commonplace these days to tackle the myriad challenges faced in integration projects. Together with continuous enhancements of the PI-centric functionality in Eclipse-based NWDS, NWDS is poised to become the single IDE for all PI/PO based development.

While ESR development and ID configuration changes are automatically tracked by PI’s internal version control, there is no built-in version control system for Java mappings and adapter module developments. It is not uncommon that Java source codes for these are developed and maintained on a developer’s local computer, with the compiled JAR/EAR files deployed manually into the server. This approach is a potential risk for an organization where the developer might leave the organization or the computer could get lost or damaged.

SAP’s own offering to address this gap is NetWeaver Development Infrastructure (NWDI). It is a full blown server based solution providing a complete Java development environment, which covers not just version control, but includes landscape management, transport & deployment mechanism and many more.

However, not many organizations have NWDI or are willing to invest in it. It may be that the cost is prohibitive with low ROI as most organizations that use SAP are still quite ABAP-centric with only minimal Java developments.

In this blog, I will introduce Git as an alternative to NWDI for version control management. It is an open-source lightweight and popular Source Code Management tool. In particular, there is an Eclipse-based EGit plugin that can be used within NWDS.

Installation

To install the plugin in NWDS, click Help > Install New Software

Unfortunately, as NWDS 7.31 is based on Galileo, an old version of Eclipse, therefore it is only compatible with an old version of the EGit plugin, version 2.1. Therefore, add the following update site for EGit version 2.1 – http://archive.eclipse.org/egit/updates-2.1

/wp-content/uploads/2015/10/site2_803708.png

Select Eclipse EGit and proceed with the rest of the installation.

/wp-content/uploads/2015/10/install_egit_803686.png

Initial Configuration

After installation has been completed, NWDS has to be restarted. Upon restart, it will usually prompt the following two warnings.

Warning 1 – HOME environment variable

/wp-content/uploads/2015/10/home_803750.png

To fix this, edit the environment variables in your computer and add HOME as a new user variable with an appropriate directory of your choice.

/wp-content/uploads/2015/10/envi_803752.png

/wp-content/uploads/2015/10/var_803756.png

Warning 2 – Git installation

This can be ignored, so check the “Do not warn” checkbox and proceed.

/wp-content/uploads/2015/10/warn_803751.png

Additionally, configure the following basic user settings under Preferences > Team > Git > Configuration

  • core.autocrlf = false
  • user.email = <your email>
  • user.name = <your name>

/wp-content/uploads/2015/10/config_803757.png

If EGit is to be used to access online repositories like GitHub, add the following key-value pair to the Git configuration.

/wp-content/uploads/2015/10/ssl_890996.png

Basic Usage of EGit

I’ll cover some basic usage of EGit just to begin with. For further information, please refer to the EGit User Guide in the reference section.

Create Git repository

Change to Git Repository Exploring perspective. Click the “Create a new Git Repository” button
/wp-content/uploads/2015/10/create_803758.png

Provide details to the new repository. Note that the user guide recommends that the Git repository is not created within the Eclipse workspace.

/wp-content/uploads/2015/10/repo_803780.png

Import existing project into Git repository

Switch back to Java EE perspective or any perspective with Project Explorer. Right click on project to be added and select Team > Share Project. Then select Git as the repository type.

/wp-content/uploads/2015/10/share1_803782.png

Select the Git repository that was previously created. Once the configuration is completed, the source codes of the project will be moved to the directory of the Git repository.

/wp-content/uploads/2015/10/share_803781.png

Add files to be tracked and commit changes

Right click on project node and select Team > Add to Index

/wp-content/uploads/2015/10/index_803798.png

Subsequently, right click on project node and select Team > Commit to commit the files to be tracked by EGit. Note that binary .class files do not need to be committed, they can optionally be ignored from further commits by configuring a .gitignore file.

/wp-content/uploads/2015/10/commit_803800.png

Conclusion

With EGit on NWDS, we can implement a simple solution to provide a Source Code Management system to manage Java developments for PI/PO. To reduce the risk of the valuable Java projects and source codes being on just a local machine, the Git repository can be hosted on a network directory, or even on a managed remote server.

References

EGit User Guide

NetWeaver Development Infrastructure (NWDI) SCN Wiki

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

  1. Thomas Lelievre-Damit

    Hey Eng Swee,

    I was following these instructions but encountered a problem when cloning a Git repo. The error I got when using connection protocol https was: cannot open git-upload-pack


    I fixed it by adding entry http.sslverify = false in the Git Configuration and restarting.


    Kind Regards,

    Thomas


    Edit: I was using SAP NWDS 7.3 SP16

    (0) 
    1. Eng Swee Yeoh Post author

      Hi Thomas

      Thanks for your comment. You are definitely right. I actually have that entry in my NWDS EGit configuration but missed including it in the instructions. I’ve updated the blog accordingly.

      Regards

      Eng Swee

      (0) 
    1. Eng Swee Yeoh Post author

      Hi Roberto

      I didn’t try it because I noticed that the development is split across multiple projects and folder structure so I’m not sure when moving it to a Git repo it will still remain consistent.

      Maybe you can try it out and let us know 😉

      Regards

      Eng Swee

      (0) 

Leave a Reply