diff --git a/build.gradle b/build.gradle index 8167bcc..7a75035 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,9 @@ -apply plugin: 'java' +plugins { + id 'application' +} repositories { - mavenCentral() + jcenter() // since the Jasper dickheads keep creating custom builds of other projects // we need to add a repository for their "special" versions @@ -11,30 +13,12 @@ } - dependencies { - // https://mvnrepository.com/artifact/com.h2database/h2 - compile group: 'com.h2database', name: 'h2', version: '1.4.196' - - // https://mvnrepository.com/artifact/net.sourceforge.dynamicreports/dynamicreports-core - compile group: 'net.sourceforge.dynamicreports', name: 'dynamicreports-core', version: '5.0.0' - - // https://mvnrepository.com/artifact/org.simplejavamail/simple-java-mail - compile group: 'org.simplejavamail', name: 'simple-java-mail', version: '4.2.3' -} - - - -sourceSets { - main { - java { - srcDir 'src' - } - resources { - srcDir 'res' - } - - } + implementation group: 'com.h2database', name: 'h2', version: '1.4.200' + implementation group: 'net.sourceforge.dynamicreports', name: 'dynamicreports-core', version: '5.0.0' + implementation group: 'org.simplejavamail', name: 'simple-java-mail', version: '4.2.3' + implementation group: 'com.formdev', name: 'flatlaf', version: '0.38' + implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1' } task download(type: Copy) { @@ -42,10 +26,51 @@ into 'libs/' } +project.configurations.implementation.setCanBeResolved(true) + jar { manifest { attributes ( - 'Main-Class': 'Main' + 'Main-Class': 'Main', + 'Class-Path': configurations.implementation.collect { 'lib/' + it.name }.join(' ') ) - } + } } + +task createMissingSourceDirs { + group = "Source Directories" + description = "Create all of the missing source directories for this project." + doFirst { + sourceSets.each { def sourceRoot -> + sourceRoot.allSource.srcDirTrees.each { def sourceDir -> + if(!sourceDir.dir.exists()) { + println "Creating ${sourceDir}" + mkdir sourceDir.dir + } + } + } + } +} + +task deleteEmptySourceDirs { + group = "Source Directories" + description = "Delete all empty source directories." + doFirst { + sourceSets.each { def sourceRoot -> + sourceRoot.allSource.srcDirTrees.each { def sourceDir -> + if(sourceDir.dir.exists() && sourceDir.dir.isDirectory() && sourceDir.dir.list().length == 0) { + println "Removing empty ${sourceDir}" + sourceDir.dir.delete() + } + } + } + } + +} + +compileJava { + sourceCompatibility = '1.8' + targetCompatibility = '1.8' +} + +mainClassName = 'Main' \ No newline at end of file