From 18a94d3059b0d0007afccac7820b1c2898df4e0f Mon Sep 17 00:00:00 2001 From: richie Date: Thu, 15 Aug 2019 18:25:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BD=BF=E7=94=A8=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 23 ++++++++++++++++++- readme.md | 12 +++++++++- src/main/java/com/fanruan/api/FineKit.java | 12 +++++++++- src/main/resources/version.properties | 3 ++- .../java/com/fanruan/api/FineKitTest.java | 3 ++- 5 files changed, 48 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 20755fc..d90e077 100644 --- a/pom.xml +++ b/pom.xml @@ -2,11 +2,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.fanruan.api - toolchain + finekit 10.0 jar 10.0-PERSIST-SNAPSHOT + yyyyMMdd + ${version} + ${maven.build.timestamp} @@ -113,6 +116,7 @@ + ${project.artifactId}-${version}-${maven.build.timestamp} maven-compiler-plugin @@ -132,6 +136,23 @@ 8 + + org.apache.maven.plugins + maven-jar-plugin + + + + false + + + + + + + src/main/resources + true + + \ No newline at end of file diff --git a/readme.md b/readme.md index 4db4f40..827473f 100644 --- a/readme.md +++ b/readme.md @@ -28,4 +28,14 @@ SessionKit#getSession(@NotNull String sessionID); * 所有的API方法均需要有单元测试覆盖。 -* 所有的API方法均需要有javadoc文档说明。 \ No newline at end of file +* 所有的API方法均需要有javadoc文档说明。 + +## 使用方法 + +先使用maven打包,执行下面的命令(跳过单元测试) + +``` + mvn package -Dmaven.test.skip=true +``` + +会在target目录下获得一个形如finekit-10.0-20190815.jar名字jar包,直接作为插件依赖jar包即可。 \ No newline at end of file diff --git a/src/main/java/com/fanruan/api/FineKit.java b/src/main/java/com/fanruan/api/FineKit.java index 0dae38a..21e188d 100644 --- a/src/main/java/com/fanruan/api/FineKit.java +++ b/src/main/java/com/fanruan/api/FineKit.java @@ -11,14 +11,17 @@ import java.util.Properties; public class FineKit { private static String version; + private static String build; static { Properties properties = new Properties(); try { properties.load(FineKit.class.getResourceAsStream("/version.properties")); version = properties.getProperty("version"); + build = properties.getProperty("build"); } catch (IOException ignore) { - version = "1.0"; + version = "10.0"; + build = "20190815"; } } @@ -30,4 +33,11 @@ public class FineKit { return version; } + /** + * 获取开发者工具套件的构建日期信息,该信息一般作为某个API是否可用的依据 + * @return 构建日期 + */ + public static String build() { + return build; + } } diff --git a/src/main/resources/version.properties b/src/main/resources/version.properties index 2a453a0..a4a820e 100644 --- a/src/main/resources/version.properties +++ b/src/main/resources/version.properties @@ -1 +1,2 @@ -version=1.0 \ No newline at end of file +version=${build-version} +build=${build-no} diff --git a/src/test/java/com/fanruan/api/FineKitTest.java b/src/test/java/com/fanruan/api/FineKitTest.java index 809c6a2..7246607 100644 --- a/src/test/java/com/fanruan/api/FineKitTest.java +++ b/src/test/java/com/fanruan/api/FineKitTest.java @@ -14,6 +14,7 @@ public class FineKitTest { @Test public void version() { - Assert.assertEquals("1.0", FineKit.version()); + Assert.assertEquals("10.0", FineKit.version()); + Assert.assertEquals("20190815", FineKit.build()); } } \ No newline at end of file