From fcac07115f5dc7172987ebfbd68fbb17a34c96ea Mon Sep 17 00:00:00 2001 From: CaiHQ Date: Thu, 21 Apr 2022 23:21:10 +0800 Subject: [PATCH 1/2] fix: startContract --- build.gradle | 7 +++++-- src/main/sdk/org/bdware/client/SmartContractHandler.java | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index edee227..a1a1615 100644 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,8 @@ version '1.0-SNAPSHOT' sourceCompatibility = 1.8 repositories { + mavenLocal() + maven { url 'https://maven.aliyun.com/repository/public' } mavenCentral() } @@ -31,11 +33,12 @@ sourceSets { } dependencies { + //api 'org.bdware.bdcontract:gmhelper:0.1.0' api project(":gmhelper") api 'javax.websocket:javax.websocket-api:1.1' api 'log4j:log4j:1.2.17' - api 'org.apache.logging.log4j:log4j-core:2.14.1' - api 'org.apache.logging.log4j:log4j-api:2.14.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' } diff --git a/src/main/sdk/org/bdware/client/SmartContractHandler.java b/src/main/sdk/org/bdware/client/SmartContractHandler.java index 601e3b8..b95ae88 100644 --- a/src/main/sdk/org/bdware/client/SmartContractHandler.java +++ b/src/main/sdk/org/bdware/client/SmartContractHandler.java @@ -110,4 +110,6 @@ public abstract class SmartContractHandler implements Handler { t.printStackTrace(); } } + + } From 934cb15ce5d7cad38f64fbf59d472a4fa0df42f6 Mon Sep 17 00:00:00 2001 From: CaiHQ Date: Fri, 22 Apr 2022 13:48:37 +0800 Subject: [PATCH 2/2] relase 0.3.0 --- build.gradle | 95 +++++++++++++++++-- src/main/java/org/bdware/client/Main.java | 1 - .../bdware/client/SmartContractHandler.java | 4 +- 3 files changed, 90 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index a1a1615..5e107ef 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,14 @@ plugins { + id 'java' id 'java-library' + id 'maven-publish' + id 'signing' } - -group 'com.bdware.sc' -version '1.0-SNAPSHOT' - +group 'org.bdware.bdcontract' +version '1.0.0' sourceCompatibility = 1.8 + repositories { mavenLocal() maven { url 'https://maven.aliyun.com/repository/public' } @@ -33,10 +35,9 @@ sourceSets { } dependencies { - //api 'org.bdware.bdcontract:gmhelper:0.1.0' - api project(":gmhelper") + 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 'log4j:log4j:1.2.17' 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' @@ -72,4 +73,84 @@ task release(type: Zip, dependsOn: ["copyJar", "copyLibs"]) { 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 } \ No newline at end of file diff --git a/src/main/java/org/bdware/client/Main.java b/src/main/java/org/bdware/client/Main.java index 7f88e7c..5f79490 100644 --- a/src/main/java/org/bdware/client/Main.java +++ b/src/main/java/org/bdware/client/Main.java @@ -4,7 +4,6 @@ import com.google.gson.JsonObject; import org.bdware.client.ws.Action; import org.zz.gmhelper.SM2KeyPair; import org.zz.gmhelper.SM2Util; - public class Main { public static void main(String[] args) throws InterruptedException { if (args.length == 0 || args[0].equals("-h") || args[0].equals("--help")) { diff --git a/src/main/sdk/org/bdware/client/SmartContractHandler.java b/src/main/sdk/org/bdware/client/SmartContractHandler.java index b95ae88..a3107dd 100644 --- a/src/main/sdk/org/bdware/client/SmartContractHandler.java +++ b/src/main/sdk/org/bdware/client/SmartContractHandler.java @@ -93,7 +93,7 @@ public abstract class SmartContractHandler implements Handler { @Override public void handle(JsonObject obj) { try { -// LOGGER.info("receive:" + obj); + LOGGER.info("receive:" + obj); if (!obj.has("action")) { LOGGER.warn("can't handle message without action: " + obj); } @@ -104,7 +104,7 @@ public abstract class SmartContractHandler implements Handler { } else { LOGGER.warn("can't handle action: " + methodName + " -> " + obj); } - } catch (SecurityException e) { + } catch (Exception e) { onUndefined(obj); } catch (Throwable t) { t.printStackTrace();