plugins { id 'application' } application { mainClass = 'service.Server' } repositories { mavenCentral() } sourceSets { 'static' { resources { srcDirs = ['static'] } java{ srcDirs = [] } } } dependencies { // jooby def joobyVer = '2.13.0' implementation group: 'io.jooby', name: 'jooby-netty', version: joobyVer implementation group: 'io.jooby', name: 'jooby-gson', version: joobyVer implementation group: 'io.jooby', name: 'jooby-swagger-ui', version: joobyVer // logging implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.36' implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.10' // H2 implementation group: 'com.h2database', name: 'h2', version: '1.4.200' // JDBI def jdbiVer = '3.21.0' implementation group: 'org.jdbi', name: 'jdbi3-core', version: jdbiVer implementation group: 'org.jdbi', name: 'jdbi3-sqlobject', version: jdbiVer // JDBC connection pool implementation group: 'com.zaxxer', name: 'HikariCP', version: '5.0.0' } /* convenience tasks */ tasks.register("createMissingSourceDirs") { group = "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 } } } } } tasks.register("deleteEmptySourceDirs") { group = "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() } } } } } tasks.register("openProjectDir") { group = "Directories" description = "Open the project root in the system file manager." doFirst { println('Opening: ' + file(projectDir)) java.awt.Desktop.getDesktop().open(file(projectDir)); } } def gitIgnored=""" .gradle .nb-gradle .classpath .project build bin dist *.zip *.tgz *.class .DS_Store """ tasks.register("createGitIgnore") { group = "Git" description = "Create the project's .gitignore file." doLast { def file = new File(projectDir, ".gitignore") if ( !file.exists() ) { println('Creating .gitignore') file.text = gitIgnored } else { println('.gitignore already exists') } } }