plugins { id 'java' id 'java-library' id 'maven-publish' id 'signing' } apply from: '../spotless.gradle' group 'org.bdware.bdcontract' version '1.0.2' sourceCompatibility = 1.8 repositories { mavenLocal() maven { url 'https://maven.aliyun.com/repository/public' } mavenCentral() } sourceSets { main { java { srcDirs 'src/main/java', 'src/main/sdk' } resources { srcDir 'src/main/resources' } } test { java { srcDir 'src/test/java' } resources { srcDir 'src/test/resources' } } } dependencies { api 'com.google.code.gson:gson:2.8.8' api 'org.bdware.bdcontract:gmhelper:0.1.0' api 'javax.websocket:javax.websocket-api:1.1' api 'org.apache.logging.log4j:log4j-core:2.17.2' api 'org.apache.logging.log4j:log4j-api:2.17.2' api 'org.glassfish.tyrus.bundles:tyrus-standalone-client:1.17' testImplementation 'junit:junit:4.13.2' } jar { String libs = '' configurations.runtimeClasspath.each { libs = libs + " libs/" + it.name } manifest { attributes 'Manifest-Version': archiveVersion // attributes 'Main-Class': "com.bdware.client.AutoRegister" attributes 'Class-Path': libs attributes 'Main-Class': 'org.bdware.client.Main' } } task copyJar(type: Copy, dependsOn: [":sdk-java:jar", ":sdk-java:copyLibs"]) { into "./build/output/" from "./build/libs/$project.name-${version}.jar" } task copyLibs(type: Copy) { into "./build/output/libs/" from configurations.runtimeClasspath } task release(type: Zip, dependsOn: ["copyJar", "copyLibs"]) { from "./build/output/" duplicatesStrategy = DuplicatesStrategy.INCLUDE archiveFileName = "java-client-${projectIds.version}.zip" destinationDirectory = file('build/') } task classJar(type: Jar, dependsOn: classes) { classifier = "jar" } 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 } publishing { publications { mavenJava(MavenPublication) { groupId project.group artifactId "sdk-java" version "${version}" from components.java artifact sourceJar artifact javadocJar artifact classJar pom { name = "bdware-sdk-java" description = "sdk-java" url = "https://gitee.com/BDWare/sdk-java" licenses { license { name = "Mulan PSL v2" url = "http://license.coscl.org.cn/MulanPSL2" } } developers { developer { id = "dataware" email = "caihq@pku.edu.cn" } } scm { connection = "scm:git:https://gitee.com/BDWare/sdk-java.git" developerConnection = "scm:git:https://gitee.com/BDWare/sdk-java.git" url = "https://gitee.com/BDWare/sdk-java" } } } } 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 }