subprojects { apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'maven' group = 'at.gv.egiz.pdfas' configurations { deployerJars } repositories { mavenCentral() } dependencies { testCompile 'junit:junit:4.8.2' //to use WebDav protocol on upload deployerJars 'org.apache.maven.wagon:wagon-webdav:1.0-beta-2' } sourceCompatibility = 1.6 version = '4.0.1' 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.9'; } 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() } checkCVE.dependsOn copyDeps uploadArchives { repositories.mavenDeployer { repository(url: project.releaseRepoUrl) snapshotRepository(url: project.snapshotRepoUrl) } } } configurations { cveCheck } // Assign dependencies to the sshAntTask configuration. dependencies { cveCheck 'org.owasp:dependency-check-ant:1.2.5' } task checkCVE << { // Redefine checkCVEAnt Ant task, with the classpath property set to our newly defined // cveCheck configuration classpath. ant.taskdef(name: 'checkCVEAnt', classname: 'org.owasp.dependencycheck.taskdefs.DependencyCheckTask', classpath: configurations.cveCheck.asPath) // executing checkCVEAnt Task ant.checkCVEAnt( applicationname: "PDF-AS", reportoutputdirectory: (new File(rootDir, 'releases/cvecheck/' + project.name)).toString(), reportformat: "ALL") { fileset(dir: (new File(rootDir, 'build/alldependencies')).toString()) { include(name: '**/**') } } } 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') }*/