When you decide to analyze your source code with a quality tool like SonarQube, sooner or later you will get messages about trailing white spaces or to replace tab with white spaces. The severity is minor and if you now use tab or white space for indentation has no effect whatsoever on my final code. At the end I run grunt and uglify over the code and unnecessary spaces are eliminated. But you may get into other problems with space / tab:
Git code review
Changes between operating systems (Linux, Windows)
Unreadable code when opened in Wordpad / Notepad / vim
Tab is normally 4 white spaces, but when defined differently on a computer, code gets really unreadable
Angry developers in endless flame wars
Now, what do to when SonarQube is showing minor problems caused by tabs?
This is caused that by default Eclipse is using tabs to indent code. You cannot change the default profile, but you can define your own. To do so, follow these steps:
Create a new profile
Windows -> Preferences
Click on New…
Inform a nice profile name.
Change the tab and white space setting.
Change tab policy to spaces only
To apply the new profile to an already edited file, you can open the file and re-format it (CTRL+SHIT+F). Running a new SonarQube analysis eliminates the white space errors:
NWDS 7.3/7.4 uses the update site concept of Eclipse. This makes it easier to update NWDS as an updated component only needs to be updated at the central update site. No need to distribute a whole NWDS installation package to the developers. The NWDS update site even includes a zip archive of the latest NWDS. That means that the developer does not have to download a NWDS version from SAP Market Place or nwds.sap.com.
There is no separate NWDS 7.4 for NetWeaver Java 7.4. You use the 7.31 version when developing applicaitons for NW 7.4 (SAP Note). To set up an update site, first download the SCA
This SCA contains the archives, but not the tool needed to create the update site. You can download the tool from here: link. This tool is available for Windows.
The tools helps you in extracting the content of the SCA and to configure the update site URL. Afterwards, create an alias in the NW Java HTTP provider and copy the files to the directory specified by the alias.
Set the alias to updatesite_731SP13. This alias points to the directory /home/cesadm/updatesite/731SP13
On the server, the folder contente looks like this:
The total size of the update size here is 2.5 GB. To access the update site via HTTP, inform the complete path to index.html:
Note 2: this plugin is not anymore valid. The blog is from 2012!
Sonar comes with a killer feature: Eclipse integration. This does not only mean that there is an Eclipse perspective available, but Sonar findings can be used with Mylyn.
To make use of the Sonar perspective, the Java project needs to be linked to the Sonar project.
Associate project with Sonar project
Select Sonar project
Now the Eclipse Sonar plugin is reading the identified issues from the Sonar server and integrates them in the editor view:
Clicking on the item in the right opens – like any other Eclipse message – a window and shows possible solutions.
The developer can now act on the violations inside Eclipse without needing to logon to the Sonar server and find there the violations for the source code he is working on.
Assume that besides the actual developers you have a code quality or coordination group that analyzes code and uses Sonar for doing so. Now Sonar shows all these violations, errors, bugs and so on, but how to communicate to the developer that he has to act on the violation? Or to guide him with documentation or how to find out why the code is written like it is? Mylyn can be used to enable that kind of collaboration. The Sonar web interface allows creating for every violation to add a comment and assign the violation to a specific user.
Sonar web interface
This review was created with the id #30 assigned to it:
After configuring Mylyn to work in Eclipse together with Sonar, the review shows up under this id in the task list:
Opening the task reveals the tasks information:
Without leaving Eclipse the developer can act on the violations assigned to him. A special feature is the ability to click on the resource link in the tasks and Eclipse will open the corresponding file automatically. The developer can mark the task as solved from within Eclipse and the task will get updated.
This change is visible immediately and does not require a new code analysis by Sonar.
Using Eclipse brings a major benefit: plugins and an eco-system. Unfortunately, SAP decides to not make their Eclipse plugins easily accessible via the update functionality, but other software vendors are not as restrictive, transforming Eclipse into a productivity tool for Java developers, making it possible to integrate it into a Java developer landscape. One can only hope that ABAP for Eclipse won’t get a second NWDS.
Having to deal with several NetWeaver servers and NWDS installations? Want to make NWDS CE 7.1 portable to be more flexible? Read on …
Developing for NetWeaver AS Java means that you have to use the NetWeaver Developer Studio. The recommendation is to have for every NW release the corresponding NWDS version installed on your computer. When you have to take care of developments running on 7.0, 7.1 and 7.2 you end up having 3 NWDS versions installed.
That is not really complicated, but when you are switching workstations, travel or want to share your NWDS installation with a co-worker things get complicated. You have to download NWDS and install it. There are several pitfalls associated with this:
administrator rights and
Even when you have the time and bandwidth, you still need to have administrator privileges to install NWDS:
The NWDS for CE download link includes a step by step manual for installing NWDS CE. Step 3 is important: “The installer starts SAP NetWeaver Developer Studio automatically and invokes the Eclipse Update Manager where you can select the available NWDS features that you want to add to your installation.”
This sentence means that you effectively install a basic Eclipse that needs to download and install all the features that transform Eclipse to NWDS. In my case, the basic NWDS CE 7.1 was roughly about 71 MB in size:
The preferences show that nothing SAP related is available.
No Java, Portal, Web Dynpro Java, DTR or any other feature and perspective related to SAP development available. Without these features you cannot develop for CE. That’s where step 3 comes in. To the 3 above mentioned possible pitfalls you have to add:
If you corporate proxy isn’t permitting Eclipse to download the features you have a useless basic Eclipse installation. NetWeaver AS Java CE comes with an update site feature (http://server:port/updatesite)  that has to be configured by the administrator or by using another connection (home, hotel, other computer). After you managed to install NWDS CE 7.1, how do you get that working version portable? After downloading the features you may be tempted to zip the folder and to copy it to an external drive to make it available as a portable NWDS (it is Eclipse and Java after all). If you do so you will notice that the installation folder is still only 71 MB. So: where are the downloaded files? NWDS CE 7.1 won’t copy them to the eclipse/plugins|features folder. They are downloaded to [username]/.eclipse/ com.sap.netweaver.developerstudio.studio_7.1.0_xyz/ configuration/ eclipse
That’s where the downloaded SAP features are. This installation path makes it complicated to use NWDS when the administrator of your company installed the features: your user does not have access to the folder. Copying them from there to the eclipse directory to make Eclipse aware of them won’t work. Inside the above directory is a file called .eclipseextension. That’s the only hint you get from SAP, but it’s enough to identify it as an extension directory. Copy that directory to another location (e.g.: E:\CE). From there the SAP features can be installed.
The manage configuration dialog (Help -> Software Updates lists the features available.
To add the extension directory: open the context menu -> add -> extension location
Select the eclipse folder.
This will install the features. After a restart of NWDS all SAP features are available: