GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
4
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
mark.george
/
marking
Browse code
Update libs. Modify build to use libs rather than lib.
master
1 parent
689d0e9
commit
8cdb94bf523cb44dc2b1374844f25e9344ae55d4
Mark George
authored
on 1 Sep 2023
Patch
Showing
1 changed file
build.gradle
Ignore Space
Show notes
View
build.gradle
plugins { id "application"; } def defaultMainClassName = "Main"; application { mainClass = project.hasProperty("mainClass") ? project.getProperty("mainClass") : defaultMainClassName; } java { sourceCompatibility = "17"; targetCompatibility = "17"; } repositories { mavenCentral() // since the Jasper devs keep using their own custom builds of ancient // versions of other projects we need to add a repository for their // "special" versions. maven { url "https://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/" } } dependencies { implementation group: "com.h2database", name: "h2", version: "2.2.220"; implementation group: "net.sourceforge.dynamicreports", name: "dynamicreports-core", version: "6.12.1"; implementation group: "org.simplejavamail", name: "simple-java-mail", version: "8.1.3"; implementation group: "com.formdev", name: "flatlaf", version: "3.2"; implementation group: "javax.xml.bind", name: "jaxb-api", version: "2.3.1"; implementation group: "org.slf4j", name: "slf4j-api", version: "2.0.7"; implementation group: "ch.qos.logback", name: "logback-classic", version: "1.4.11"; implementation group: "io.github.resilience4j", name: "resilience4j-retry", version: "2.1.0"; implementation group: "io.github.resilience4j", name: "resilience4j-circuitbreaker", version: "2.1.0"; testImplementation group: 'com.icegreen', name: 'greenmail', version: '2.0.0' } project.configurations.implementation.setCanBeResolved(true) jar { manifest { attributes ( "Main-Class": defaultMainClassName, "Class-Path": configurations.implementation.collect { "libs/" + it.name }.join(" ") ) } } /* convenience tasks for working with a project */ tasks.register("copyDependencies", Copy) { group = "Project"; description = "Copy all dependencies into a 'libs' folder in the root of the project."; from configurations.implementation into 'libs/' } tasks.register("createMissingSourceDirs") { group = "Project"; 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 = "Project"; description = "Delete 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 = "Project"; description = "Open the project directory in the system file manager."; doFirst { println("Opening: " + file(projectDir)); java.awt.Desktop.getDesktop().open(file(projectDir)); } } tasks.register("openBuildDir") { group = "Project"; description = "Open the project build directory in the system file manager."; doFirst { println("Opening: " + file(buildDir)); java.awt.Desktop.getDesktop().open(file(buildDir)); } } tasks.register("createGitIgnore") { group = "Project"; description = "Create the project's .gitignore file."; def gitIgnored=""" .gradle/ .nb-gradle/ .settings/ nbproject/ build/ bin/ dist/ tmp/ .classpath .project *.zip *.tgz *.tar.gz *.class *.jar .DS_Store !gradle-wrapper.jar """; doLast { def file = new File(projectDir, ".gitignore"); if ( !file.exists() ) { println("Creating .gitignore"); gitIgnored.lines().each { f -> if(!f.trim().isBlank()) { file.append(f.trim()+"\n"); } } } else { println(".gitignore already exists"); } } }
plugins { id "application"; } def defaultMainClassName = "Main"; application { mainClass = project.hasProperty("mainClass") ? project.getProperty("mainClass") : defaultMainClassName; } java { sourceCompatibility = "17"; targetCompatibility = "17"; } repositories { mavenCentral() // since the Jasper devs keep using their own custom builds of ancient // versions of other projects we need to add a repository for their // "special" versions. maven { url "https://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/" } } dependencies { implementation group: "com.h2database", name: "h2", version: "2.1.214"; implementation group: "net.sourceforge.dynamicreports", name: "dynamicreports-core", version: "6.12.1"; implementation group: "org.simplejavamail", name: "simple-java-mail", version: "8.1.0"; implementation group: "com.formdev", name: "flatlaf", version: "3.1.1"; implementation group: "javax.xml.bind", name: "jaxb-api", version: "2.3.1"; implementation group: "org.slf4j", name: "slf4j-api", version: "2.0.7"; implementation group: "ch.qos.logback", name: "logback-classic", version: "1.4.7"; implementation group: "io.github.resilience4j", name: "resilience4j-retry", version: "2.0.2"; implementation group: "io.github.resilience4j", name: "resilience4j-circuitbreaker", version: "2.0.2"; testImplementation group: 'com.icegreen', name: 'greenmail', version: '2.0.0' } project.configurations.implementation.setCanBeResolved(true) jar { manifest { attributes ( "Main-Class": "Main", "Class-Path": configurations.implementation.collect { "lib/" + it.name }.join(" ") ) } } /* convenience tasks for working with a project */ tasks.register("copyDependencies", Copy) { group = "Project"; description = "Copy all dependencies into a 'libs' folder in the root of the project."; from configurations.implementation into 'libs/' } tasks.register("createMissingSourceDirs") { group = "Project"; 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 = "Project"; description = "Delete 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 = "Project"; description = "Open the project directory in the system file manager."; doFirst { println("Opening: " + file(projectDir)); java.awt.Desktop.getDesktop().open(file(projectDir)); } } tasks.register("openBuildDir") { group = "Project"; description = "Open the project build directory in the system file manager."; doFirst { println("Opening: " + file(buildDir)); java.awt.Desktop.getDesktop().open(file(buildDir)); } } tasks.register("createGitIgnore") { group = "Project"; description = "Create the project's .gitignore file."; def gitIgnored=""" .gradle/ .nb-gradle/ .settings/ nbproject/ build/ bin/ dist/ tmp/ .classpath .project *.zip *.tgz *.tar.gz *.class *.jar .DS_Store !gradle-wrapper.jar """; doLast { def file = new File(projectDir, ".gitignore"); if ( !file.exists() ) { println("Creating .gitignore"); gitIgnored.lines().each { f -> if(!f.trim().isBlank()) { file.append(f.trim()+"\n"); } } } else { println(".gitignore already exists"); } } }
Show line notes below