buildscript { repositories { gradlePluginPortal() mavenCentral() } dependencies { classpath "com.github.ben-manes:gradle-versions-plugin:0.28.0" classpath "org.owasp:dependency-check-gradle:6.5.0.1" } } allprojects { apply plugin: "com.github.ben-manes.versions" repositories { mavenCentral() maven { url "https://repo.spring.io/milestone/" } } version = '4.3.0' } subprojects { apply plugin: 'java-library' apply plugin: 'eclipse' apply plugin: 'maven-publish' apply plugin: 'maven' apply plugin: 'org.owasp.dependencycheck' group = 'at.gv.egiz.pdfas' configurations { deployerJars } repositories { mavenCentral() mavenLocal() maven { url "https://repo.spring.io/milestone/" mavenContent { releasesOnly() } } maven { url "https://apps.egiz.gv.at/maven/" mavenContent { releasesOnly() } } maven { url "https://apps.egiz.gv.at/maven-snapshot/" mavenContent { snapshotsOnly() } } } dependencies { compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.24' annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.24' testImplementation 'junit:junit:4.13.2' } task sourcesJar(type: Jar, dependsOn: classes) { classifier = 'sources' from sourceSets.main.allSource } artifacts { archives sourcesJar } sourceCompatibility = 1.8 compileJava.options.encoding = "UTF-8" compileTestJava.options.encoding = "UTF-8" project.ext{ releaseRepoUrl = "file://${project(':').projectDir}/../mvn-repo/releases" snapshotRepoUrl = "file://${project(':').projectDir}/../mvn-repo/snapshots" version = version pdfasversion = version revision = getCheckedOutGitCommitHash() //tomcatVersion = '7.0.54'; //tomcatVersion = '8.0.36'; tomcatVersion = '9.0.73'; slf4jVersion = '1.7.36' cxfVersion = '3.5.5' } jar { manifest.attributes provider: 'EGIZ', 'Specification-Version': getCheckedOutGitCommitHash(), 'Implementation-Version': project.version } task copyDeps(type: Copy) { from configurations.runtime into (new File(rootDir, 'build/alldependencies')).toString() } task copyDepsLocal(type: Copy) { from configurations.runtime into 'build/alldependencies' } publishing { publications { myLibrary(MavenPublication) { from components.java } } repositories { maven { name = 'egiz_repo' url = version.endsWith('SNAPSHOT') ? project.snapshotRepoUrl : project.releaseRepoUrl } } } dependencies { deployerJars "org.apache.maven.wagon:wagon-ssh:3.4.3" } uploadArchives { repositories.mavenDeployer { configuration = configurations.deployerJars repository(url: "sftp://apps.egiz.gv.at/maven") { authentication(userName: System.getenv("EGIZ_MAVEN_USER"), password: System.getenv("EGIZ_MAVEN_PASSWORD")) } snapshotRepository(url: "sftp://apps.egiz.gv.at/maven-snapshot") { authentication(userName: System.getenv("EGIZ_MAVEN_USER"), password: System.getenv("EGIZ_MAVEN_PASSWORD")) } } } task(internalRelease) { doLast { } } internalRelease.dependsOn jar internalRelease.dependsOn sourcesJar gradle.taskGraph.whenReady {taskGraph -> //if (taskGraph.hasTask(release)) { // version = '1.0' //} else { // version = '1.0-SNAPSHOT' //} } //doFullRelease jar war distZip distTar releases sourcesJar uploadArchives } task(doFullRelease) { doLast { println "done building all distribution stuff for " + project.version } } task copyLicenses { doLast { mkdir("releases/"+ version +"/licenses"); def target = project.projectDir.toString() + "/releases/" + version + "/licenses" subprojects{ def src=project.projectDir.toString() + "/licenses" copy{ from src into target } } } } task releases(type: Copy) { dependsOn copyLicenses from ('doc') { include '*.pdf' } into "releases/" + version + "/docs" } def getCheckedOutGitCommitHash() { def gitFolder = "$projectDir/.git/" def takeFromHash = 40 /* * '.git/HEAD' contains either * in case of detached head: the currently checked out commit hash * otherwise: a reference to a file containing the current commit hash */ def head = new File(gitFolder + "HEAD").text.split(":") // .git/HEAD def isCommit = head.length == 1 // e5a7c79edabbf7dd39888442df081b1c9d8e88fd // def isRef = head.length > 1 // ref: refs/heads/master if(isCommit) return head[0].trim().take(takeFromHash) // e5a7c79edabb def refHead = new File(gitFolder + head[1].trim()) // .git/refs/heads/master refHead.text.trim().take takeFromHash } /* task docs(type: Javadoc) { source subprojects.collect {project -> project.sourceSets.main.allJava } classpath = files(subprojects.collect {project -> project.sourceSets.main.compileClasspath}) destinationDir = new File(projectDir, 'docs/full') }*/