Update 19 Feb 2016: Additional configuration entry when using EGit with online repositories.
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.
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
Select Eclipse EGit and proceed with the rest of the installation.
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
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.
Warning 2 – Git installation
This can be ignored, so check the “Do not warn” checkbox and proceed.
Additionally, configure the following basic user settings under Preferences > Team > Git > Configuration
- core.autocrlf = false
- user.email = <your email>
- user.name = <your name>
If EGit is to be used to access online repositories like GitHub, add the following key-value pair to the Git configuration.
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
Provide details to the new repository. Note that the user guide recommends that the Git repository is not created within the Eclipse workspace.
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.
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.
Add files to be tracked and commit changes
Right click on project node and select Team > Add to Index
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.
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.