sdk-java/build.gradle

159 lines
4.1 KiB
Groovy
Raw Permalink Normal View History

2021-09-24 09:57:22 +00:00
plugins {
2022-04-22 05:48:37 +00:00
id 'java'
2021-09-24 09:57:22 +00:00
id 'java-library'
2022-04-22 05:48:37 +00:00
id 'maven-publish'
id 'signing'
2021-09-24 09:57:22 +00:00
}
apply from: '../spotless.gradle'
2022-04-22 05:48:37 +00:00
group 'org.bdware.bdcontract'
2023-05-27 05:16:22 +00:00
version '1.0.2'
2021-09-24 09:57:22 +00:00
sourceCompatibility = 1.8
2022-04-22 05:48:37 +00:00
2021-09-24 09:57:22 +00:00
repositories {
2022-04-21 15:21:10 +00:00
mavenLocal()
maven { url 'https://maven.aliyun.com/repository/public' }
2021-09-24 09:57:22 +00:00
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 {
2022-04-22 05:48:37 +00:00
api 'com.google.code.gson:gson:2.8.8'
api 'org.bdware.bdcontract:gmhelper:0.1.0'
2021-09-24 09:57:22 +00:00
api 'javax.websocket:javax.websocket-api:1.1'
2022-04-21 15:21:10 +00:00
api 'org.apache.logging.log4j:log4j-core:2.17.2'
api 'org.apache.logging.log4j:log4j-api:2.17.2'
2021-09-24 09:57:22 +00:00
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/')
2022-04-22 05:48:37 +00:00
}
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
2021-09-24 09:57:22 +00:00
}