Monday, October 1, 2018

Snapshot of Java 11 Features

New features from the developer’s perspective:


I think the most important feature from above is, HTTP Client API. As you must aware there are a number of existing HTTP client API’s and implementations exist, e.g. Jetty and the Apache Http Client – In fact, I was using Apache Http Client since there was no standardized API from the Java. 

Other important thing here is - Removal of Java EE and CORBA modules. Many projects still using JAXB API's and now they need to package them as third-party jars.

Memory and Performance tuning:
   (Experimental)

However, none of them impact the hotspot GC. Those are introduced to address various use cases especially for testing and performance tuning and need to enable them through specific flags.

Deprecated Features:


Lot of people uses the Nashron JS engine to run the JS code from the Java – this might be a huge impact for those people.

Thursday, September 27, 2018

When to amend/squash commits and how to maintain a clean PR

I always like to improve the development process with the git and a strong believer in the clean code.
Something which I always insist during my PR review is - maintain the clean git history by avoiding the unnecessary indivual commits. 

Broadly, we can follow these 2 rules:

  1. amend/squash commits if they don't add semantic value to the PR
  2. Always rebase the PR before you push to the server

Below article exactly reflects my thought on this.



Other nice articles on this:

https://www.atlassian.com/git/tutorials/rewriting-history
https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History

Friday, September 21, 2018

Setting a specific Java version to maven if you've multiple Java versions installed in the system

This is for the macOS:

By default, maven runs with the default JAVA_HOME configured in the system. If you want to set a different Java version temporarily for your maven - we need to change the JAVA_HOME in the mvn file. 

mvn shell file

#!/bin/bash
JAVA_HOME="${JAVA_HOME:-$(/usr/libexec/java_home)}" exec "/usr/local/Cellar/maven/3.5.2/libexec/bin/mvn" "$@"


Changed mvn shell file this to:

#!/bin/bash
JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home" exec "/usr/local/Cellar/maven/3.5.2/libexec/bin/mvn" "$@"

However, if you wish to set a particular java version to the project permanently - that needs to be configured in the pom.xml file

Refer here:                   


For example, to set for Java 1.8
<properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
 </properties>


Java 7:

<properties>
        <maven.compiler.target>1.7</maven.compiler.target>
        <maven.compiler.source>1.7</maven.compiler.source>
 </properties>


 But where can I find this mvn file in macOS?
$ which mvn
/usr/local/bin/mvn

$ cat mvn
#!/bin/bash
JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home" exec "/usr/local/Cellar/maven/3.5.2/libexec/bin/mvn" "$@"

As you can see - mvn file is located in /usr/local/Cellar/maven/3.5.2/libexec/bin/



Monday, September 17, 2018

Git tag operations

First, let me check my branch and the origin

item-ax40113:es6features kkolipaka$ git branch
* master

item-ax40113:es6features kkolipaka$ git remote -v
origin https://github.com/kolipakakondal/es6features.git (fetch)
origin https://github.com/kolipakakondal/es6features.git (push)


Let me view my existing git tags on this branch

$ git tag
1.0.1
1.0.2
1.0.2.201807
1.0.2.20180730


Create a new git called "1.0.3"

$ git tag 1.0.3

$ git tag
1.0.1
1.0.2
1.0.2.201807
1.0.2.20180730
1.0.3


Create a new git tag with the message

$ git tag 1.0.4 -m "1.0.4 GA release"
$ git show 1.0.4
tag 1.0.4
Tagger: Kondal Kolipaka <kondal.kolipaka@gmail.com>
Date:   Mon Sep 17 15:56:31 2018 +0800

1.0.4 GA release

commit 24302d15e49d24ee208ca7eb725f34dbf37cd0ef
Author: Kondal Kolipaka <kondal.kolipaka@gmail.com>
Date:   Mon Jul 30 18:20:46 2018 +0800

    adding comment for test


Push git tag to the remote server repository

$ git push origin 1.0.4
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 1.43 KiB | 0 bytes/s, done.
Total 5 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/kolipakakondal/es6features.git
 * [new tag]         1.0.4 -> 1.0.4



Let me rename git tag from "1.0.4" to "1.0.4.GA"

$ git tag
1.0.1
1.0.2
1.0.2.201807
1.0.2.20180730
1.0.3
1.0.4

$ git tag 1.0.4.GA 1.0.4
$ git tag
1.0.1
1.0.2
1.0.2.201807
1.0.2.20180730
1.0.3
1.0.4
1.0.4.GA


Let me push the newly git to the remote repo

Before that, let me delete my git tag first from the local repo
$ git tag -d 1.0.4
Deleted tag '1.0.4' (was c3a04e7)
item-ax40113:es6features kkolipaka$ git tag
1.0.1
1.0.2
1.0.2.201807
1.0.2.20180730
1.0.3
1.0.4.GA


Let me also delete my old git tag "1.0.4" from the remote repo

$ git push origin :1.0.4
To https://github.com/kolipakakondal/es6features.git
 - [deleted]         1.0.4


Now, let me push my renamed git tag "1.0.4.GA" to the remote server

item-ax40113:es6features kkolipaka$ git push origin 1.0.4.GA
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 1.43 KiB | 0 bytes/s, done.
Total 5 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/kolipakakondal/es6features.git

 * [new tag]         1.0.4.GA -> 1.0.4.GA



Here is my current release commits for 1.0.4 GA, git tag "1.0.4.GA" is created on the latest commit which is "24302"

$ git log --pretty=oneline
24302d15e49d24ee208ca7eb725f34dbf37cd0ef adding comment for test
f9446b4a8dc7112eb64f60981a3700ae49cf483b some more changes
58694540ee96369dd34898288ac1bfb1f0ac203e some more changes
b1743684346a42cc3b0820b2e1241bfc3f794a1a changes
ba039a51a49ae67cbb3fb9c3c2f8d49335588eca Update .mergify.yml
c458c898ec1efcd2d1c03b762b8d2437dc5ce644 Enable mergify.io
3632a41f38bc7ee7ad409666397301f80815ff58 ES6 sample app for Appcelerator titanium

Fix#1 added

$ git add es6features/LICENSE.txt
$ git commit -m "Fix1 on 1.0.4 GA release"
[master be67c9f] Fix1 on 1.0.4 GA release
 1 file changed, 2 insertions(+), 1 deletion(-)

Fix#2 added

$ git add es6features/LICENSE.txt
$ git commit -m "Fix2 on 1.0.4 GA release"
[master a609582] Fix2 on 1.0.4 GA release
 1 file changed, 2 insertions(+), 1 deletion(-)


2 new commits added after 1.0.4 GA release

item-ax40113:es6features kkolipaka$ git log --pretty=oneline
a60958216f0e64c2d9374978e0064585e6bca7b2 Fix2 on 1.0.4 GA release
be67c9f4d7780686eb7469ab681bc7f0ee3ca4ca Fix1 on 1.0.4 GA release
24302d15e49d24ee208ca7eb725f34dbf37cd0ef adding comment for test
f9446b4a8dc7112eb64f60981a3700ae49cf483b some more changes
58694540ee96369dd34898288ac1bfb1f0ac203e some more changes
b1743684346a42cc3b0820b2e1241bfc3f794a1a changes
ba039a51a49ae67cbb3fb9c3c2f8d49335588eca Update .mergify.yml
c458c898ec1efcd2d1c03b762b8d2437dc5ce644 Enable mergify.io
3632a41f38bc7ee7ad409666397301f80815ff58 ES6 sample app for Appcelerator titanium



Now we want to make a release 1.0.5 with only Fix#1 - In this case, we need to create a tag with the Fix1 commit hash id.

$ git tag -a 1.0.5.GA be67c9f4d7780686eb7469ab681bc7f0ee3ca4ca -m "1.0.5 GA release with the Fix#1" 

$ git tag
1.0.1
1.0.2
1.0.2.201807
1.0.2.20180730
1.0.3
1.0.4.GA
1.0.5.GA