plugins { id 'java' id 'java-library' id 'maven-publish' id 'signing' } apply from: '../spotless.gradle' group = "org.bdware.sc" version = "1.9.2" tasks.withType(JavaCompile) { // options.compilerArgs << '-Xlint:none' // options.compilerArgs << '-Xlint:deprecation' << "-Werror" options.compilerArgs << '-parameters' } repositories { mavenCentral() mavenLocal() } sourceSets { main { java { srcDirs 'src/main/java', 'src/main/debugger', 'src/main/data-mask' } resources { srcDir 'src/main/resources' } } test { java { srcDirs 'src/test/java', 'src/test/data-mask' } resources { srcDir 'src/test/resources' } } } dependencies { api project(":common") api project(":mockjava") implementation 'org.bdware:delta-crdts:1.1.0' implementation 'org.apache.commons:commons-lang3:3.0' implementation 'com.atlassian.commonmark:commonmark:0.17.0' implementation 'com.idealista:format-preserving-encryption:1.0.0' implementation 'org.apache.commons:commons-math3:3.6.1' implementation 'org.codehaus.groovy:groovy-all:3.0.8' implementation 'io.grpc:grpc-all:1.41.0' implementation 'org.jsoup:jsoup:1.14.2' implementation 'com.sun.mail:javax.mail:1.6.2' implementation 'com.squareup.okhttp3:okhttp:4.9.1' implementation 'org.bdware.bdcontract:sdk-java:1.0.2' implementation 'org.bdware.doip:doip-audit-tool:1.3.2' implementation 'org.bdware.doip:doip-sdk:1.4.6' implementation fileTree(dir: 'lib', include: '*.jar') testImplementation 'junit:junit:4.13.2' } tasks.jar.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE) task classJar(type: Jar, dependsOn: classes) { classifier = "jar" } jar { String libs = '' configurations.runtimeClasspath.each { libs = libs + " libs/" + it.name } from { // uncomment this when publish, // while develop at local use "false" configurations.runtimeClasspath.filter { it.getAbsolutePath().contains("/lib/") // false }.collect { it.isDirectory() ? it : zipTree(it) } } manifest { attributes 'Manifest-Version': project.version attributes 'Main-Class': 'org.bdware.sc.ContractProcess' attributes 'Class-Path': libs } } tasks.withType(Copy).all { duplicatesStrategy = DuplicatesStrategy.INCLUDE } tasks.withType(Jar).all { duplicatesStrategy = DuplicatesStrategy.INCLUDE } task copyLibs(type: Copy, dependsOn: ":common:jar") { into "./build/output/libs/" from configurations.runtimeClasspath } task copyJar(type: Copy, dependsOn: [":cp:jar", ":cp:copyLog4jProp"]) { into "./build/output/" from "./build/libs/$project.name-${version}.jar" rename { String fileName -> "yjs.jar" } } task copyLog4jProp(type: Copy) { into "./build/output/" from "./src/main/resources/log4j2.debug.properties" from "./src/main/resources/log4j2.properties" } task buildBundle(dependsOn: [":cp:copyLibs", ":cp:copyJar"]) { doLast { println "buildBundle in ./build/output/ successfully" } } task sourceJar(type: Jar, dependsOn: classes) { archiveClassifier = "sources" classifier = "sources" from sourceSets.main.allSource } tasks.withType(Javadoc) { options.addStringOption('Xdoclint:none', '-quiet') } task javadocJar(type: Jar, dependsOn: javadoc) { archiveClassifier = 'javadoc' classifier = "javadoc" exclude { details -> details.file.getAbsolutePath().contains("/gm/") } from javadoc.destinationDir } //shadowJar { // // classifier = "jar" // dependencies { // include(dependency(fileTree(dir: 'lib', include: '*.jar'))) //// exclude(dependency('com.google.code.gson:gson:2.8.6')) //// relocate 'com.google.code.gson', 'irs.com.google.code.gson' // } //} publishing { publications { mavenJava(MavenPublication) { groupId project.group artifactId "cp" version "${version}" from components.java artifact sourceJar artifact javadocJar artifact classJar // artifact customFatJar pom { name = "bdware-cp" description = "cp" url = "https://gitee.com/BDWare/cp" licenses { license { name = "GPL v2" url = "https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt" } } developers { developer { id = "dataware" email = "caihq@pku.edu.cn" } } scm { connection = "scm:git:https://gitee.com/BDWare/cp.git" developerConnection = "scm:git:https://gitee.com/BDWare/cp.git" url = "https://gitee.com/BDWare/cp" } } } } repositories { maven { name 'bdwareSnapshotRepository' url 'https://oss.sonatype.org/content/repositories/snapshots' credentials { username = "${NEXUS_USERNAME}" password = "${NEXUS_PASSWORD}" } } maven { name 'bdwareRepository' url 'https://oss.sonatype.org/service/local/staging/deploy/maven2' credentials { username = "${NEXUS_USERNAME}" password = "${NEXUS_PASSWORD}" } } } } signing { sign publishing.publications.mavenJava }