Posts

Showing posts from June, 2018

Introduction To Gradle

The Gradle is a groovy based build tool. I used to install sdkman to setup Gradle as well as maven in my machine because sdkman allow you to install number of version and use any version of the tool at the time it necessary. This is a great feature I was expecting as a developer. So exciting with sdkman. In the following example, I used Gradle version 3.4.1 to setup the multi-moudle project. Here the parent gradle.build file: task wrapper (type: Wrapper){ gradleVersion = '3.4.1' distributionType = Wrapper.DistributionType.ALL } subprojects{ apply plugin: 'java' dependencies { // https://mvnrepository.com/artifact/org.slf4j/slf4j-api compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' } repositories { mavenCentral() } jar { baseName = 'example1' version = '0.0.1-SNAPSHOT' } } As shown in the above, If you need to use wrapper (which

Scala Tips - separating common from varying

It is a best practice to separating common from varying in the Scala. Common parts are implemented as functions and the varying parts will be arguments: def createSeqOnCriteria(start:Int, end:Int, // createSeqOnCriteria: createSeqOnCriteria[](val start: Int,val end: Int,val criteria: Int => Boolean) => scala.collection.immutable.IndexedSeq[Int] criteria: Int => Boolean) = { // for (i <- start to end if criteria(i)) yield i // } //