From 912ecc21fc038918f186adc21e8f9c8366125a00 Mon Sep 17 00:00:00 2001 From: CaiHQ Date: Mon, 24 Apr 2023 18:58:17 +0800 Subject: [PATCH] add public support --- build.gradle | 82 +++++++++++++++++++ .../server/http/HttpFileHandleAdapter.java | 2 + 2 files changed, 84 insertions(+) diff --git a/build.gradle b/build.gradle index 64ba39e..9641dcd 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,8 @@ plugins { id 'java' id 'java-library' + id 'maven-publish' + id 'signing' } sourceSets { @@ -27,3 +29,83 @@ dependencies { api 'com.google.code.gson:gson:2.8.8' testImplementation 'junit:junit:4.13.2' } +version = "1.0.0" +task classJar(type: Jar, dependsOn: classes) { + classifier = "jar" +} +task sourceJar(type: Jar, dependsOn: classes) { + archiveClassifier = "sources" + classifier = "sources" + from sourceSets.main.allSource + duplicatesStrategy = DuplicatesStrategy.EXCLUDE +} + +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 "front-base" + version "${version}" + from components.java + artifact sourceJar + artifact javadocJar + artifact classJar + pom { + name = "bdware-front-base" + description = "front-base" + url = "https://gitee.com/BDWare/front-base" + 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/front-base.git" + developerConnection = "scm:git:https://gitee.com/BDWare/front-base.git" + url = "https://gitee.com/BDWare/front-base" + } + } + + } + } + repositories { + maven { + name 'bdwareSnapshot' + url 'https://oss.sonatype.org/content/repositories/snapshots' + credentials { + username = "${NEXUS_USERNAME}" + password = "${NEXUS_PASSWORD}" + } + } + maven { + name 'bdware' + url 'https://oss.sonatype.org/service/local/staging/deploy/maven2' + credentials { + username = "${NEXUS_USERNAME}" + password = "${NEXUS_PASSWORD}" + } + } + } +} +signing { + sign publishing.publications.mavenJava +} \ No newline at end of file diff --git a/src/main/src/org/bdware/server/http/HttpFileHandleAdapter.java b/src/main/src/org/bdware/server/http/HttpFileHandleAdapter.java index b3dc875..bc6c306 100644 --- a/src/main/src/org/bdware/server/http/HttpFileHandleAdapter.java +++ b/src/main/src/org/bdware/server/http/HttpFileHandleAdapter.java @@ -45,6 +45,8 @@ public class HttpFileHandleAdapter extends SimpleChannelInboundHandler