Browse Source

新增使用说明

master
richie 5 years ago
parent
commit
18a94d3059
  1. 23
      pom.xml
  2. 12
      readme.md
  3. 12
      src/main/java/com/fanruan/api/FineKit.java
  4. 3
      src/main/resources/version.properties
  5. 3
      src/test/java/com/fanruan/api/FineKitTest.java

23
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"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.fanruan.api</groupId> <groupId>com.fanruan.api</groupId>
<artifactId>toolchain</artifactId> <artifactId>finekit</artifactId>
<version>10.0</version> <version>10.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<common-version>10.0-PERSIST-SNAPSHOT</common-version> <common-version>10.0-PERSIST-SNAPSHOT</common-version>
<maven.build.timestamp.format>yyyyMMdd</maven.build.timestamp.format>
<build-version>${version}</build-version>
<build-no>${maven.build.timestamp}</build-no>
</properties> </properties>
<dependencies> <dependencies>
<!-- core包 --> <!-- core包 -->
@ -113,6 +116,7 @@
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}-${version}-${maven.build.timestamp}</finalName>
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
@ -132,6 +136,23 @@
<target>8</target> <target>8</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>false</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
</plugins> </plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build> </build>
</project> </project>

12
readme.md

@ -28,4 +28,14 @@ SessionKit#getSession(@NotNull String sessionID);
* 所有的API方法均需要有单元测试覆盖。 * 所有的API方法均需要有单元测试覆盖。
* 所有的API方法均需要有javadoc文档说明。 * 所有的API方法均需要有javadoc文档说明。
## 使用方法
先使用maven打包,执行下面的命令(跳过单元测试)
```
mvn package -Dmaven.test.skip=true
```
会在target目录下获得一个形如finekit-10.0-20190815.jar名字jar包,直接作为插件依赖jar包即可。

12
src/main/java/com/fanruan/api/FineKit.java

@ -11,14 +11,17 @@ import java.util.Properties;
public class FineKit { public class FineKit {
private static String version; private static String version;
private static String build;
static { static {
Properties properties = new Properties(); Properties properties = new Properties();
try { try {
properties.load(FineKit.class.getResourceAsStream("/version.properties")); properties.load(FineKit.class.getResourceAsStream("/version.properties"));
version = properties.getProperty("version"); version = properties.getProperty("version");
build = properties.getProperty("build");
} catch (IOException ignore) { } catch (IOException ignore) {
version = "1.0"; version = "10.0";
build = "20190815";
} }
} }
@ -30,4 +33,11 @@ public class FineKit {
return version; return version;
} }
/**
* 获取开发者工具套件的构建日期信息该信息一般作为某个API是否可用的依据
* @return 构建日期
*/
public static String build() {
return build;
}
} }

3
src/main/resources/version.properties

@ -1 +1,2 @@
version=1.0 version=${build-version}
build=${build-no}

3
src/test/java/com/fanruan/api/FineKitTest.java

@ -14,6 +14,7 @@ public class FineKitTest {
@Test @Test
public void version() { public void version() {
Assert.assertEquals("1.0", FineKit.version()); Assert.assertEquals("10.0", FineKit.version());
Assert.assertEquals("20190815", FineKit.build());
} }
} }
Loading…
Cancel
Save