Featured post

Fixed Income Trading: New venues ( How many Fixed Income trading venues are there? )

How many Fixed Income trading venues are there?  [152]  A simple question came up recently in a conversation – how many new Fixed Income t...

Wednesday, 7 August 2019

Java, Gradle, Shadow and FatJar or UberJar

Say you want to build an executable Jar file - one that can execute from the command line

$java -jar /path/to/myFile.jar

Below is a build.gradle that does this for you, using Maven as an artefact repository and the Shadow Gradle adding


plugins {
    // Apply the java plugin to add support for Java
    id 'java'
    id 'com.github.johnrengelman.shadow' version '5.1.0'    

repositories {

sourceSets {
main {
java {
srcDir 'src'
      srcDir 'config'
      srcDir 'lib'

targetCompatibility  = JavaVersion.toVersion(10)
sourceCompatibility  = JavaVersion.toVersion(10)

classifier = null
attributes 'Main-Class':'com.alignmentsystems.engine.Worker'
attributes 'class-path':'.'
attributes 'Version':'0.9.1.' 

dependencies {
implementation 'org.apache.mina:mina-core:2.0.9'
implementation 'ch.qos.logback:logback-core:1.1.3'
implementation 'ch.qos.logback:logback-classic:1.1.3'
implementation 'org.slf4j:slf4j-api:1.7.21'

No comments:

Post a comment