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


Tuesday, April 24, 2018

Singapore ThoughtWorks Tech Radar

Less than a week ago, I was invited to attend ThoughtWorks Tech Radar, Singapore and debate and discuss on the latest technologies along with the other senior technologists.

It was an interesting session and enjoyed sharing my perspective on the latest technologies!

You can view Singapore radar from here  Your very own Tech Radar.







Thursday, April 19, 2018

Redis meetup, Singpaore


Few days back, I got a chance to attend Redis Meetup in Singapore, and it was an interesting session!

I thought, I could share some of my learnings from the session!

Major features:
  1. It’s a in-memory data structure - so you can expect more RAM if you want to store more data!
  2. It’s blazing fast!
  3. Easy and versatile
  4. No SQL
  5. Stores the data in key-value way
  6. Can be used as Cache buffer, Message broker, Pub/sub and in streams
  7. It’s a single threaded.
  8. Can be deployed in the “cluster” mode, scalable up to 1000 nodes!!
  9. It has self healing feature - if the master goes down, automatically slave node will become the master and align with the other nodes

It’s used in the WhatsApp, Twitter, Uber, Grab, Airbnb, Netflix and many more! - This is very interesting to me since I use most of these apps in my day-to-day life!

The only problem I heard is - It’s very difficult manage Redis Cluster and it doesn’t guarantee consistency!!


Quick start:

Installing in macOS:
  1. Download the latest stable version Redis 4.0.9 is the latest stable version.
  2. Extract the tar file
  3. Run "sudo make Install" from the root directory


Quick test:

item-ax30641:redis-4.0.9 kkolipaka$ redis-cli ping
PONG
item-ax30641:redis-4.0.9 kkolipaka$ redis-cli
127.0.0.1:6379> set mykey helloworld
OK
127.0.0.1:6379> get mykey

"helloworld"





Resources:

https://redis.io/


Monday, April 16, 2018

Adding "Available Software Sites" for your eclipse RCP

An Installable Unit can be augmented at generation time by writing a p2 advice file (p2.inf). The format of this file is java properties file containing key=value pairs. From Eclipse 3.5, touchpoint advice files can be placed:
  • In bundles (META-INF/p2.inf): The instructions are added to the installable unit for the bundle
  • In features (a p2.inf file co-located with the feature.xml): The instructions are added to the installable unit for the feature group
  • In products (a p2.inf file co-located with the .product file): The instructions are added to the root installable unit for that product.

I would like to add p2.inf file at the same level of the .product file and add the below content with the my software update site and eclipse Oxygen update site

Project Structure:




p2.inf content:

instructions.install = \    addRepository(location:http${#58}//my.com/standalone/update/stable/,name:my studio Stable Updates,type:0,enabled:true);\
    addRepository(location:http${#58}//my.com//standalone/update/stable/,my studio Stable Updates,type:1,enabled:true);\
    addRepository(location:http${#58}//download.eclipse.org/releases/oxygen,name:Eclipse Oxygen Update Site,type:0,enabled:false);\
    addRepository(location:http${#58}//download.eclipse.org/releases/oxygen,name:Eclipse Oxygen Update Site,type:1,enabled:false);



Resources:

Thursday, December 14, 2017

Update Eclipse Luna to Mars,Neon and Oxygen


Due to structural changes you cannot update from a Mars (or prior) all-in-one package to a Oxygen version. If interested in the technical details, see bug 332989 and bug 490515 and Bug 462282

http://www.eclipse.org/eclipse/news/4.5/platform.php#macapp
https://wiki.eclipse.org/Platform-releng/Issues_related_to_Mac_App_installations