Merge pull request #15 from aasaru/gradle_4.10.3

FINCN-179 gradle to 4.10.3, FINCN-178 make Travis build forks, ...
diff --git a/README.md b/README.md
index 12d5de8..f19ea69 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@
-# Apache Fineract CN Identity Manager [![Build Status](https://api.travis-ci.com/apache/fineract-cn-identity.svg?branch=develop)](https://travis-ci.com/apache/fineract-cn-identity)
+# Apache Fineract CN Identity Manager [![Build Status](https://api.travis-ci.com/apache/fineract-cn-identity.svg?branch=develop)](https://travis-ci.com/apache/fineract-cn-identity)  [![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/apache/fineract-cn-identity)](https://hub.docker.com/r/apache/fineract-cn-identity/builds)
 
 This project provides identity management for Apache Fineract CN services.
+[Read more](https://cwiki.apache.org/confluence/display/FINERACT/Fineract+CN+Project+Structure#FineractCNProjectStructure-identity).
 
 ## Abstract
 Apache Fineract CN is an application framework for digital financial services, a system to support nationwide and cross-national financial transactions and help to level and speed the creation of an inclusive, interconnected digital economy for every nation in the world.
diff --git a/api/build.gradle b/api/build.gradle
index 0563fa0..36420e0 100644
--- a/api/build.gradle
+++ b/api/build.gradle
@@ -16,20 +16,18 @@
  */
 
 buildscript {
-
     repositories {
         jcenter()
     }
-
-    dependencies {
-        classpath 'io.spring.gradle:dependency-management-plugin:0.6.0.RELEASE'
-    }
 }
 
 plugins {
     id 'com.github.hierynomus.license' version '0.13.1'
-    id("org.nosphere.apache.rat") version "0.3.1"
+    id("org.nosphere.apache.rat") version "0.5.2"
     id "com.jfrog.artifactory" version "4.9.5"
+    id "io.spring.dependency-management" version "1.0.8.RELEASE"
+    id 'maven-publish'
+    id 'java'
 }
 
 apply from: '../shared.gradle'
diff --git a/build.gradle b/build.gradle
index 5f4070d..a854b32 100644
--- a/build.gradle
+++ b/build.gradle
@@ -46,6 +46,13 @@
     dependsOn gradle.includedBuild('service').task(':artifactoryPublish')
 }
 
+task clean {
+    group 'all'
+    dependsOn gradle.includedBuild('api').task(':clean')
+    dependsOn gradle.includedBuild('service').task(':clean')
+    dependsOn gradle.includedBuild('component-test').task(':clean')
+}
+
 task licenseFormat {
     group 'all'
     dependsOn gradle.includedBuild('api').task(':licenseFormat')
diff --git a/component-test/build.gradle b/component-test/build.gradle
index 517915d..cfb2685 100644
--- a/component-test/build.gradle
+++ b/component-test/build.gradle
@@ -25,20 +25,27 @@
     }
 
     dependencies {
-        classpath ("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
         classpath("org.asciidoctor:asciidoctor-gradle-plugin:1.5.3")
     }
 }
 
 plugins {
     id 'com.github.hierynomus.license' version '0.13.1'
-    id("org.nosphere.apache.rat") version "0.3.1"
+    id("org.nosphere.apache.rat") version "0.5.2"
     id "com.jfrog.artifactory" version "4.9.5"
+    id "org.springframework.boot" version "1.4.3.RELEASE"
+    id 'maven'
+    id 'maven-publish'
+    id 'java'
 }
 
 apply from: '../shared.gradle'
 apply plugin: 'org.asciidoctor.convert'
 
+bootRepackage {
+    enabled = false
+}
+
 dependencies {
     compile(
             [group: 'org.apache.fineract.cn.identity', name: 'api', version: rootProject.version],
@@ -60,4 +67,5 @@
         options backend: "html", doctype: "book"
         attributes "source-highlighter": "highlightjs", \
                 'snippets': file('build/doc/generated-snippets/')
-    }
\ No newline at end of file
+    }
+
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 31c5854..94336fc 100644
--- a/gradle/wrapper/gradle-wrapper.jar
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 5b5835e..290541c 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Tue Mar 14 14:09:59 CET 2017
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-bin.zip
diff --git a/gradlew b/gradlew
index 4453cce..cccdd3d 100755
--- a/gradlew
+++ b/gradlew
@@ -33,11 +33,11 @@
 # Use the maximum available, or set MAX_FD != -1 to use that value.
 MAX_FD="maximum"
 
-warn ( ) {
+warn () {
     echo "$*"
 }
 
-die ( ) {
+die () {
     echo
     echo "$*"
     echo
@@ -155,7 +155,7 @@
 fi
 
 # Escape application args
-save ( ) {
+save () {
     for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
     echo " "
 }
diff --git a/service/build.gradle b/service/build.gradle
index 5e37b3d..fbe2c87 100644
--- a/service/build.gradle
+++ b/service/build.gradle
@@ -19,28 +19,26 @@
     ext {
         springBootVersion = '1.4.1.RELEASE'
     }
-
     repositories {
         jcenter()
     }
-
-    dependencies {
-        classpath ("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
-    }
 }
 
 plugins {
     id 'com.github.hierynomus.license' version '0.13.1'
-    id("org.nosphere.apache.rat") version "0.3.1"
+    id("org.nosphere.apache.rat") version "0.5.2"
     id "com.jfrog.artifactory" version "4.9.5"
+    id "org.springframework.boot" version "1.4.3.RELEASE"
+    id 'maven'
+    id 'maven-publish'
+    id 'java'
+    id 'idea'
 }
 
 apply from: '../shared.gradle'
 
-apply plugin: 'spring-boot'
-
-springBoot {
-    executable = true
+bootRepackage {
+    enabled = true
     classifier = 'boot'
 }
 
@@ -60,12 +58,13 @@
             [group: 'org.apache.fineract.cn.anubis', name: 'api', version: versions.frameworkanubis],
             [group: 'org.apache.fineract.cn.anubis', name: 'library', version: versions.frameworkanubis],
             [group: 'io.netty', name: 'netty-all', version: '4.1.39.Final'],
-            [group: 'io.netty', name: 'netty-transport-native-epoll', version: '4.1.39.Final'],
+            [group: 'io.netty', name: 'netty-transport-native-epoll', version: '4.1.39.Final']
     )
 }
 
-publishToMavenLocal.dependsOn bootRepackage
-
+tasks.withType(PublishToMavenLocal) { task ->
+    task.dependsOn 'bootRepackage'
+}
 
 publishing {
     publications {
@@ -77,7 +76,7 @@
         }
         bootService(MavenPublication) {
             // "boot" jar
-            artifact ("$buildDir/libs/$project.name-$version-boot.jar")
+            artifact(file("$buildDir/libs/$project.name-$project.version-${bootRepackage.classifier}.jar"))
             groupId project.group
             artifactId ("$project.name-boot")
             version project.version
diff --git a/service/src/main/resources/application.yml b/service/src/main/resources/application.yml
index 9d0b4ff..60e913c 100644
--- a/service/src/main/resources/application.yml
+++ b/service/src/main/resources/application.yml
@@ -31,7 +31,7 @@
       registerWithEureka: false
 
 server:
-  port: 8081
+  port: 2021
   contextPath: /identity/v1
 
 endpoints:
@@ -69,4 +69,4 @@
 
 identity:
   passwordExpiresInDays: 93
-  timeToChangePasswordAfterExpirationInDays: 4
\ No newline at end of file
+  timeToChangePasswordAfterExpirationInDays: 4
diff --git a/service/src/main/resources/banner.txt b/service/src/main/resources/banner.txt
new file mode 100644
index 0000000..3fdb85a
--- /dev/null
+++ b/service/src/main/resources/banner.txt
@@ -0,0 +1,11 @@
+  _____ _                           _         ____ _   _
+ |  ___(_)_ __   ___ _ __ __ _  ___| |_      / ___| \ | |
+ | |_  | | '_ \ / _ \ '__/ _` |/ __| __|____| |   |  \| |
+ |  _| | | | | |  __/ | | (_| | (__| ||_____| |___| |\  |
+ |_|   |_|_| |_|\___|_|  \__,_|\___|\__|     \____|_| \_|
+  ___    _            _   _ _
+ |_ _|__| | ___ _ __ | |_(_) |_ _   _
+  | |/ _` |/ _ \ '_ \| __| | __| | | |
+  | | (_| |  __/ | | | |_| | |_| |_| |
+ |___\__,_|\___|_| |_|\__|_|\__|\__, |
+                                |___/
diff --git a/shared.gradle b/shared.gradle
index e036a9d..2b7a08c 100644
--- a/shared.gradle
+++ b/shared.gradle
@@ -18,12 +18,6 @@
 group 'org.apache.fineract.cn.identity'
 version '0.1.0-BUILD-SNAPSHOT'
 
-apply plugin: 'java'
-apply plugin: 'idea'
-apply plugin: 'maven-publish'
-apply plugin: 'io.spring.dependency-management'
-
-
 ext.versions = [
         frameworkcrypto    : '0.1.0-BUILD-SNAPSHOT',
         frameworkanubis    : '0.1.0-BUILD-SNAPSHOT',
@@ -78,7 +72,7 @@
 }
 
 jar {
-    from sourceSets.main.allSource
+    from sourceSets.main.java
     duplicatesStrategy = DuplicatesStrategy.EXCLUDE
 }
 
@@ -114,6 +108,9 @@
 rat {
     // List of exclude directives, defaults to ['**/.gradle/**']
     excludes = [
+            "**/target/**",
+            "**/*.log",
+            "**/banner.txt",
             "**/.dockerignore/**",
             "**/.idea/**",
             "**/.gradle/**",
@@ -123,5 +120,4 @@
             "gradlew.bat",
             "README.md"
     ]
-    plainOutput = true
 }
diff --git a/travis.sh b/travis.sh
index 03a75ee..d54330d 100755
--- a/travis.sh
+++ b/travis.sh
@@ -36,6 +36,12 @@
   ./gradlew publishToMavenLocal rat || EXIT_STATUS=$?
 }
 
+# Builds Forked (non-apache) Repository
+function build_fork() {
+  echo -e "Building branch $TRAVIS_BRANCH of fork $TRAVIS_REPO_SLUG. Won't publish anything to Artifactory."
+  ./gradlew publishToMavenLocal rat || EXIT_STATUS=$?
+}
+
 # For other branches we need to add branch name as prefix
 function build_otherbranch() {
   echo -e "Building a snapshot out of branch [$TRAVIS_BRANCH] and publishing it with prefix '${TRAVIS_BRANCH}-SNAPSHOT'"
@@ -49,17 +55,19 @@
 
 }
 
+echo -e "TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG"
 echo -e "TRAVIS_BRANCH=$TRAVIS_BRANCH"
 echo -e "TRAVIS_TAG=$TRAVIS_TAG"
 echo -e "TRAVIS_COMMIT=${TRAVIS_COMMIT::7}"
 echo -e "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST"
 
-# Build Logic
-if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
+if [[ $TRAVIS_REPO_SLUG != apache* ]]; then
+  build_fork
+elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
   build_pullrequest
-elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" != "$BUILD_SNAPSHOTS_BRANCH" ] && [ "$TRAVIS_TAG" == "" ]  ; then
+elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" != "$BUILD_SNAPSHOTS_BRANCH" ] && [ "$TRAVIS_TAG" == "" ]; then
   build_otherbranch
-elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "$BUILD_SNAPSHOTS_BRANCH" ] && [ "$TRAVIS_TAG" == "" ] ; then
+elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "$BUILD_SNAPSHOTS_BRANCH" ] && [ "$TRAVIS_TAG" == "" ]; then
   build_snapshot
 elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ]; then
   build_tag