plugins { id 'java' id 'jacoco' id 'eclipse' id 'signing' id 'maven-publish' id 'com.github.johnrengelman.shadow' //version '7.1.0' } group = 'net.gredler' archivesBaseName = 'aegis4j' version = '1.2' repositories { mavenCentral() } dependencies { implementation 'org.javassist:javassist:3.28.0-GA' testImplementation 'org.springframework:spring-core:5.3.14' testImplementation 'com.unboundid:unboundid-ldapsdk:3.1.1' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' // vulnerable to CVE-2021-44228 testImplementation 'org.apache.logging.log4j:log4j-core:2.14.1' // vulnerable to CVE-2015-7501 testImplementation 'org.apache.commons:commons-collections4:4.0' // vulnerable to CVE-2019-17531 testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.9.10' testImplementation('log4j:apache-log4j-extras:1.2.17') { exclude group: 'log4j', module: 'log4j' } // testImplementation group: 'com.ea.agentloader', name: 'ea-agent-loader', version: '1.0.3' testImplementation "com.google.guava:guava:$guava_version" } sourceCompatibility = 8 targetCompatibility = 8 compileJava.options.encoding = 'UTF-8' compileTestJava.options.encoding = 'UTF-8' javadoc.options.encoding = 'UTF-8' java { //withJavadocJar() //withSourcesJar() } test { jvmArgs "-javaagent:${shadowJar.archiveFile.get()}=dynamic" useJUnitPlatform() systemProperty 'jdk.attach.allowAttachSelf', 'true' // tests attach agent to local VM systemProperty 'aegis4j.projectRoot', "${project.rootDir.toString()}" forkEvery 1 // tests cannot undo class modifications to clean up after themselves testLogging { events 'passed', 'skipped', 'failed' showExceptions true showStackTraces true showStandardStreams false exceptionFormat 'full' } } jar { archiveClassifier.set('no-deps') manifest.attributes( 'Implementation-Title': 'aegis4j', 'Implementation-Version': archiveVersion, 'Main-Class': 'net.gredler.aegis4j.AegisAgent', 'Agent-Class': 'net.gredler.aegis4j.AegisAgent', 'Premain-Class': 'net.gredler.aegis4j.AegisAgent', 'Can-Redefine-Classes': true, 'Can-Retransform-Classes': true, 'Can-Set-Native-Method-Prefix': false ) } shadowJar { archiveClassifier.set('') relocate 'javassist', 'net.gredler.aegis4j.javassist' } tasks.build.dependsOn tasks.shadowJar tasks.test.dependsOn tasks.shadowJar /* publishing { publications { mavenJava(MavenPublication) { publication -> project.shadow.component(publication) artifact sourcesJar artifact javadocJar pom { groupId = 'net.gredler' name = 'aegis4j' url = 'https://github.com/gredler/aegis4j' description = 'A Java agent which disables dangerous rarely-used runtime features.' licenses { license { name = 'The Apache License, Version 2.0' url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' } } developers { developer { id = 'gredler' name = 'Daniel Gredler' email = 'daniel.gredler@gmail.com' } } scm { url = 'https://github.com/gredler/aegis4j' connection = 'scm:git:git://github.com/gredler/aegis4j.git' developerConnection = 'scm:git:ssh:git@github.com:gredler/aegis4j.git' } } } } repositories { maven { url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' credentials { username = project.hasProperty('ossrhUsername') ? ossrhUsername : 'unknown' password = project.hasProperty('ossrhPassword') ? ossrhPassword : 'unknown' } } } } signing { sign publishing.publications.mavenJava } */