feat: 更新 hbase 示例

master
dunwu 2023-11-30 07:07:31 +08:00
parent 81a350aa6d
commit 6c3031b874
17 changed files with 1151 additions and 212 deletions

View File

@ -3,69 +3,57 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.github.dunwu</groupId>
<artifactId>javadb-hbase</artifactId>
<artifactId>javadb</artifactId>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>javadb-hbase</artifactId>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<hbase.version>2.4.15</hbase.version>
<junit.version>4.13.1</junit.version>
<dunwu.version>0.5.7</dunwu.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>${hbase.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-auth</artifactId>
<version>2.10.2</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.18</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.13.4</version>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>5.1.10.RELEASE</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.6.3</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -20,9 +20,9 @@ import java.lang.annotation.Target;
public @interface RowKeyRule {
/**
*
* get
*/
String pk();
String uk();
/**
* {@link RowType}

View File

@ -1,111 +0,0 @@
package io.github.dunwu.javadb.hbase.annotation;
import cn.hutool.core.util.HashUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import io.github.dunwu.javadb.hbase.entity.BaseHbaseEntity;
import java.lang.reflect.Field;
/**
* {@link RowKeyRule}
*
* @author <a href="mailto:forbreak@163.com">Zhang Peng</a>
* @date 2023-11-20
*/
public class RowKeyRuleParser {
/**
*
*/
public static <T extends BaseHbaseEntity> String getRowKey(T entity) throws IllegalArgumentException {
String row = null;
Class<? extends BaseHbaseEntity> clazz = entity.getClass();
RowKeyRule rule = clazz.getAnnotation(RowKeyRule.class);
if (rule == null) {
throw new IllegalArgumentException(StrUtil.format("实体定义错误!未定义 @RowKeyRule", entity.getClass(),
BaseHbaseEntity.class.getCanonicalName()));
}
Field field = ReflectUtil.getField(clazz, rule.pk());
if (field == null) {
throw new IllegalArgumentException(StrUtil.format("实体定义错误!@RowKeyRule 中未指定 value", entity.getClass(),
BaseHbaseEntity.class.getCanonicalName()));
}
switch (rule.type()) {
case ORIGIN_ID:
row = getRowKeyForOriginId(entity, field, rule);
break;
case TIMESTAMP:
row = getRowKeyForTimestamp();
break;
case UUID:
row = IdUtil.fastSimpleUUID();
break;
case BUCKET:
row = getRowKeyForBucket(entity, field, rule);
default:
break;
}
if (StrUtil.isBlank(row)) {
throw new IllegalArgumentException(StrUtil.format("实体定义错误!未定义 @RowKeyRule", entity.getClass(),
BaseHbaseEntity.class.getCanonicalName()));
}
return row;
}
private static <T extends BaseHbaseEntity> String getRowKeyForOriginId(T entity, Field field, RowKeyRule rule)
throws IllegalArgumentException {
String originId;
Object value = ReflectUtil.getFieldValue(entity, field);
if (value instanceof String) {
originId = (String) value;
} else {
originId = String.valueOf(value);
}
if (rule.length() == 0) {
throw new IllegalArgumentException(
StrUtil.format("实体定义错误!{} 选择 @RowKey 的 type 为 {},必须指定 length 且不能为 0",
entity.getClass(), rule.type()));
}
return StrUtil.padPre(originId, rule.length(), "0");
}
private static String getRowKeyForTimestamp() {
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
return StrUtil.padPre(timestamp, 10, "0");
}
private static <T extends BaseHbaseEntity> String getRowKeyForBucket(T entity, Field field, RowKeyRule rowKeyRule)
throws IllegalArgumentException {
if (rowKeyRule.bucket() == 0) {
throw new IllegalArgumentException(
StrUtil.format("实体定义错误!{} 选择 @RowKey 的 type 为 {},必须指定 bucket 且不能为 0",
entity.getClass(), rowKeyRule.type()));
}
String originId = getRowKeyForOriginId(entity, field, rowKeyRule);
int bucketLength = getBucketIdLength(rowKeyRule.bucket());
String bucketId = String.valueOf(HashUtil.fnvHash(originId) % rowKeyRule.bucket());
return StrUtil.padPre(bucketId, bucketLength, "0") + originId;
}
private static int getBucketIdLength(int bucket) {
bucket = bucket - 1;
if (bucket <= 0) {
return 1;
}
int length = 0;
while (bucket > 0) {
length++;
bucket = bucket / 10;
}
return length;
}
}

View File

@ -0,0 +1,142 @@
package io.github.dunwu.javadb.hbase.annotation;
import cn.hutool.core.util.HashUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import io.github.dunwu.javadb.hbase.constant.RowType;
import io.github.dunwu.javadb.hbase.entity.BaseHbaseEntity;
import java.lang.reflect.Method;
/**
* {@link RowKeyRule}
*
* @author <a href="mailto:forbreak@163.com">Zhang Peng</a>
* @date 2023-11-20
*/
public class RowKeyUtil {
/**
*
*/
public static <T extends BaseHbaseEntity> String getRowKey(T entity) throws IllegalArgumentException {
String row = null;
Class<? extends BaseHbaseEntity> clazz = entity.getClass();
RowKeyRule rule = getRowKeyRule(entity.getClass());
Method method = ReflectUtil.getMethodByName(clazz, rule.uk());
if (method == null) {
String msg = StrUtil.format("{} 实体类定义错误!@RowKeyRule 指定的 uk{} 方法未找到!",
clazz.getCanonicalName(), rule.uk());
throw new IllegalArgumentException(msg);
}
switch (rule.type()) {
case ORIGIN_ID:
row = getRowKeyForOriginId(entity, method, rule.length());
break;
case TIMESTAMP:
row = getRowKeyForTimestamp();
break;
case UUID:
row = IdUtil.fastSimpleUUID();
break;
case BUCKET:
row = getRowKeyForBucket(entity, method, rule.length(), rule.bucket());
default:
break;
}
if (StrUtil.isBlank(row)) {
throw new IllegalArgumentException(StrUtil.format("实体定义错误!未定义 @RowKeyRule", entity.getClass(),
BaseHbaseEntity.class.getCanonicalName()));
}
return row;
}
public static RowKeyRule getRowKeyRule(Class<? extends BaseHbaseEntity> clazz) {
RowKeyRule rule = clazz.getAnnotation(RowKeyRule.class);
if (rule == null) {
String msg = StrUtil.format("{} 实体类定义错误!未定义 @RowKeyRule", clazz.getCanonicalName());
throw new IllegalArgumentException(msg);
}
if (rule.type() == RowType.ORIGIN_ID && rule.length() <= 0) {
String msg = StrUtil.format("{} 实体类定义错误!@RowKeyRule type 为 ORIGIN_ID 时length 必须大于 0",
clazz.getCanonicalName());
throw new IllegalArgumentException(msg);
}
if (rule.type() == RowType.BUCKET && (rule.length() <= 0 || rule.bucket() <= 0)) {
String msg = StrUtil.format("{} 实体类定义错误!@RowKeyRule type 为 BUCKET 时length 和 bucket 必须大于 0",
clazz.getCanonicalName());
throw new IllegalArgumentException(msg);
}
return rule;
}
public static <T extends BaseHbaseEntity> String getRowKeyForOriginId(T entity, Method method, int length)
throws IllegalArgumentException {
String originId;
Object value = ReflectUtil.invoke(entity, method);
if (value instanceof String) {
originId = (String) value;
} else {
originId = String.valueOf(value);
}
if (length == 0) {
throw new IllegalArgumentException("length 不能为 0");
}
return getRowKeyForOriginId(originId, length);
}
public static String getRowKeyForOriginId(String bizId, int length) {
return StrUtil.padPre(bizId, length, "0");
}
public static String getRowKeyForTimestamp() {
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
return StrUtil.padPre(timestamp, 10, "0");
}
public static <T extends BaseHbaseEntity> String getRowKeyForBucket(T entity, Method method, int length, int bucket)
throws IllegalArgumentException {
if (bucket == 0) {
throw new IllegalArgumentException("bucket 不能为 0");
}
String originId = getRowKeyForOriginId(entity, method, length);
int bucketLength = getBucketIdLength(bucket);
String bucketId = String.valueOf(HashUtil.fnvHash(originId) % bucket);
return StrUtil.padPre(bucketId, bucketLength, "0") + originId;
}
public static <T extends BaseHbaseEntity> String getRowKeyForBucket(String contentId, Class<T> clazz) {
RowKeyRule rule = RowKeyUtil.getRowKeyRule(clazz);
return RowKeyUtil.getRowKeyForBucket(contentId, rule.length(), rule.bucket());
}
public static String getRowKeyForBucket(String bizId, int length, int bucket) throws IllegalArgumentException {
String originId = getRowKeyForOriginId(bizId, length);
int bucketLength = getBucketIdLength(bucket);
String bucketId = String.valueOf(HashUtil.fnvHash(originId) % bucket);
return StrUtil.padPre(bucketId, bucketLength, "0") + originId;
}
private static int getBucketIdLength(int bucket) {
bucket = bucket - 1;
if (bucket <= 0) {
return 1;
}
int length = 0;
while (bucket > 0) {
length++;
bucket = bucket / 10;
}
return length;
}
}

View File

@ -0,0 +1,12 @@
package io.github.dunwu.javadb.hbase.entity;
import io.github.dunwu.javadb.hbase.mapper.UkGetter;
/**
* HBase Content
*
* @author <a href="mailto:forbreak@163.com">Zhang Peng</a>
* @date 2023-11-24
*/
public interface BaseHbaseContentEntity extends UkGetter, BaseHbaseEntity {
}

View File

@ -1,7 +1,7 @@
package io.github.dunwu.javadb.hbase.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.github.dunwu.javadb.hbase.annotation.RowKeyRuleParser;
import io.github.dunwu.javadb.hbase.annotation.RowKeyUtil;
/**
* HBase
@ -16,7 +16,7 @@ public interface BaseHbaseEntity {
*/
@JsonIgnore
default String getRowKey() {
return RowKeyRuleParser.getRowKey(this);
return RowKeyUtil.getRowKey(this);
}
}

View File

@ -72,7 +72,7 @@ public abstract class BaseHbaseMapper<T extends BaseHbaseEntity> implements Hbas
}
@Override
public int deleteBatchIds(Collection<? extends Serializable> ids) {
public int deleteBatchById(Collection<? extends Serializable> ids) {
if (CollectionUtil.isEmpty(ids)) {
return 0;

View File

@ -0,0 +1,21 @@
package io.github.dunwu.javadb.hbase.mapper;
import io.github.dunwu.javadb.hbase.HbaseTemplate;
import io.github.dunwu.javadb.hbase.entity.BaseHbaseContentEntity;
import lombok.extern.slf4j.Slf4j;
/**
* HBase Mapper
*
* @author <a href="mailto:forbreak@163.com">Zhang Peng</a>
* @date 2023-11-15
*/
@Slf4j
public abstract class BaseHbaseUkMapper<T extends BaseHbaseContentEntity> extends BaseHbaseMapper<T>
implements HbaseUkMapper<T> {
public BaseHbaseUkMapper(HbaseTemplate hbaseTemplate) {
super(hbaseTemplate);
}
}

View File

@ -1,7 +1,10 @@
package io.github.dunwu.javadb.hbase.mapper;
import cn.hutool.core.collection.CollectionUtil;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
@ -17,7 +20,9 @@ public interface CommonMapper<T> {
*
* @param entity
*/
int insert(T entity);
default int insert(T entity) {
return insertBatch(Collections.singleton(entity));
}
/**
*
@ -31,7 +36,9 @@ public interface CommonMapper<T> {
*
* @param id ID
*/
int deleteById(Serializable id);
default int deleteById(Serializable id) {
return deleteBatchById(Collections.singleton(id));
}
/**
* (ID)
@ -45,14 +52,16 @@ public interface CommonMapper<T> {
*
* @param idList ID( null empty)
*/
int deleteBatchIds(Collection<? extends Serializable> idList);
int deleteBatchById(Collection<? extends Serializable> idList);
/**
* ID
* ID
*
* @param entity
*/
int updateById(T entity);
default int updateById(T entity) {
return updateBatchById(Collections.singleton(entity));
}
/**
*
@ -66,7 +75,13 @@ public interface CommonMapper<T> {
*
* @param id ID
*/
T getOneById(Serializable id);
default T getOneById(Serializable id) {
List<T> list = getListByIds(Collections.singleton(id));
if (CollectionUtil.isEmpty(list)) {
return null;
}
return list.get(0);
}
/**
* ID

View File

@ -0,0 +1,77 @@
package io.github.dunwu.javadb.hbase.mapper;
import cn.hutool.core.collection.CollectionUtil;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* Mapper
*
* @author <a href="mailto:forbreak@163.com">Zhang Peng</a>
* @date 2023-11-23
*/
public interface CommonUkMapper<T extends UkGetter> extends CommonMapper<T> {
/**
*
*
* @param uk
*/
default int deleteByUk(Serializable uk) {
return deleteBatchByUk(Collections.singleton(uk));
}
/**
*
*
* @param entity
*/
int deleteByUk(T entity);
/**
*
*
* @param ukList
*/
int deleteBatchByUk(Collection<? extends Serializable> ukList);
/**
*
*
* @param entity
*/
default int updateByUk(T entity) {
return updateBatchByUk(Collections.singleton(entity));
}
/**
*
*
* @param list
*/
int updateBatchByUk(Collection<T> list);
/**
*
*
* @param uk
*/
default T getOneByUk(Serializable uk) {
List<T> list = getListByUk(Collections.singleton(uk));
if (CollectionUtil.isEmpty(list)) {
return null;
}
return list.get(0);
}
/**
*
*
* @param ukList
*/
List<T> getListByUk(Collection<? extends Serializable> ukList);
}

View File

@ -53,13 +53,6 @@ public interface HbaseMapper<T extends BaseHbaseEntity> extends CommonMapper<T>
return save(entity);
}
/**
*
*
* @param entity
*/
int save(T entity);
@Override
default int insertBatch(Collection<T> list) {
return batchSave(list);
@ -70,6 +63,13 @@ public interface HbaseMapper<T extends BaseHbaseEntity> extends CommonMapper<T>
return batchSave(list);
}
/**
*
*
* @param entity
*/
int save(T entity);
/**
*
*

View File

@ -0,0 +1,74 @@
package io.github.dunwu.javadb.hbase.mapper;
import cn.hutool.core.collection.CollectionUtil;
import io.github.dunwu.javadb.hbase.annotation.RowKeyUtil;
import io.github.dunwu.javadb.hbase.entity.BaseHbaseContentEntity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
/**
* Hbase Content Mapper
*
* @author <a href="mailto:forbreak@163.com">Zhang Peng</a>
* @date 2023-11-15
*/
public interface HbaseUkMapper<T extends BaseHbaseContentEntity> extends HbaseMapper<T>, CommonUkMapper<T> {
@Override
default int deleteByUk(Serializable uk) {
String rowKey = RowKeyUtil.getRowKeyForBucket((String) uk, getEntityClass());
return deleteById(rowKey);
}
@Override
default int deleteByUk(T entity) {
String rowKey = RowKeyUtil.getRowKeyForBucket(entity.getUk(), getEntityClass());
return deleteById(rowKey);
}
@Override
default int deleteBatchByUk(Collection<? extends Serializable> ukList) {
if (CollectionUtil.isEmpty(ukList)) {
return 0;
}
List<String> rowKeys = ukList.stream()
.map(contentId -> RowKeyUtil.getRowKeyForBucket((String) contentId,
getEntityClass()))
.collect(Collectors.toList());
return deleteBatchById(rowKeys);
}
@Override
default int updateByUk(T entity) {
return save(entity);
}
@Override
default int updateBatchByUk(Collection<T> list) {
return batchSave(list);
}
@Override
default T getOneByUk(Serializable uk) {
String rowKey = RowKeyUtil.getRowKeyForBucket((String) uk, getEntityClass());
return getOneById(rowKey);
}
@Override
default List<T> getListByUk(Collection<? extends Serializable> ukList) {
if (CollectionUtil.isEmpty(ukList)) {
return new ArrayList<>();
}
List<String> rowKeys = ukList.stream()
.map(contentId -> RowKeyUtil.getRowKeyForBucket((String) contentId,
getEntityClass()))
.collect(Collectors.toList());
return getListByIds(rowKeys);
}
}

View File

@ -0,0 +1,16 @@
package io.github.dunwu.javadb.hbase.mapper;
/**
* Get
*
* @author <a href="mailto:forbreak@163.com">Zhang Peng</a>
* @date 2023-11-24
*/
public interface UkGetter {
/**
*
*/
String getUk();
}

View File

@ -67,7 +67,7 @@ public class HbaseMapperTest {
Assertions.assertThat(list.size()).isEqualTo(1);
System.out.println(JSONUtil.toJsonStr(list));
mapper.deleteBatchIds(Collections.singletonList(originOrder.getRowKey()));
mapper.deleteBatchById(Collections.singletonList(originOrder.getRowKey()));
List<Order> list2 = mapper.getListByIds(Collections.singletonList(originOrder.getRowKey()));
Assertions.assertThat(list2).isEmpty();

View File

@ -21,7 +21,7 @@ import java.util.Map;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@RowKeyRule(pk = "id", length = 20)
@RowKeyRule(uk = "getId", length = 20)
public class Order implements BaseHbaseEntity {
private String id;

View File

@ -17,7 +17,7 @@ import java.math.BigDecimal;
@Data
@NoArgsConstructor
@AllArgsConstructor
@RowKeyRule(pk = "id", length = 10)
@RowKeyRule(uk = "getId", length = 10)
public class Product implements BaseHbaseEntity {
private String id;

View File

@ -8,6 +8,136 @@
<version>1.0.0</version>
<packaging>pom</packaging>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.version>3.5.4</maven.version>
<!-- ========================================================
Core Versions
========================================================= -->
<spring-boot.version>2.2.2.RELEASE</spring-boot.version>
<hadoop.version>3.3.6</hadoop.version>
<!-- ==========================================
Java Web
=========================================== -->
<javax.mail.version>1.6.2</javax.mail.version>
<javax.servlet.jsp-api.version>2.3.3</javax.servlet.jsp-api.version>
<javax.servlet.jsp.jstl.version>1.2</javax.servlet.jsp.jstl.version>
<!-- ==========================================
Java Data
=========================================== -->
<curator.version>4.2.0</curator.version>
<druid.version>1.1.24</druid.version>
<fastdfs.version>1.26.6</fastdfs.version>
<mybatis.version>3.5.6</mybatis.version>
<mybatis-generator.version>1.3.5</mybatis-generator.version>
<mybatis-plus.version>3.4.2</mybatis-plus.version>
<mybatis-spring.version>2.0.2</mybatis-spring.version>
<mybatis.mapper.version>4.0.4</mybatis.mapper.version>
<mybatis.pagehelper.version>5.1.8</mybatis.pagehelper.version>
<hibernate-validator.version>6.2.5.Final</hibernate-validator.version>
<p6spy.version>3.8.7</p6spy.version>
<hbase.version>2.4.15</hbase.version>
<!-- ==========================================
序列化 / JavaBean
=========================================== -->
<dozer.version>6.4.1</dozer.version>
<fastjson.version>1.2.70</fastjson.version>
<fst.version>2.56</fst.version>
<lombok.version>1.18.16</lombok.version>
<protobuf-java.version>3.16.1</protobuf-java.version>
<reflections.version>0.10.2</reflections.version>
<!-- ========================================================
Common tools Versions
========================================================= -->
<commons-codec.version>1.12</commons-codec.version>
<commons-collections4.version>4.3</commons-collections4.version>
<commons-compress.version>1.20</commons-compress.version>
<commons-configuration2.version>2.7</commons-configuration2.version>
<commons-csv.version>1.6</commons-csv.version>
<commons-fileupload.version>1.4</commons-fileupload.version>
<commons-io.version>2.7</commons-io.version>
<commons-lang3.version>3.9</commons-lang3.version>
<commons-math3.version>3.6.1</commons-math3.version>
<commons-pool2.version>2.8.0</commons-pool2.version>
<commons-text.version>1.10.0</commons-text.version>
<guava.version>31.1-jre</guava.version>
<hutool.version>5.8.9</hutool.version>
<!-- ========================================================
Special tools Versions
========================================================= -->
<poi.version>4.1.2</poi.version>
<disruptor.version>3.4.2</disruptor.version>
<drools.version>7.11.0.Final</drools.version>
<jjwt.version>0.11.1</jjwt.version>
<jsoup.version>1.14.2</jsoup.version>
<junit-jupiter.version>5.6.0</junit-jupiter.version>
<mvel.version>2.4.7.Final</mvel.version>
<shiro.version>1.7.1</shiro.version>
<swagger.ui>2.9.2</swagger.ui>
<swagger-annotations.version>1.5.22</swagger-annotations.version>
<swagger-spring-boot-starter.version>1.9.0.RELEASE</swagger-spring-boot-starter.version>
<thumbnailator.version>0.4.19</thumbnailator.version>
<zxing.version>3.4.0</zxing.version>
<easyexcel.version>3.1.1</easyexcel.version>
<javaparser.version>3.24.0</javaparser.version>
<!-- ========================================================
Apache Plugins Versions
========================================================= -->
<maven-antrun-plugin.version>3.0.0</maven-antrun-plugin.version>
<maven-assembly-plugin.version>3.2.0</maven-assembly-plugin.version>
<maven-checkstyle-plugin.version>3.1.1</maven-checkstyle-plugin.version>
<maven-clean-plugin.version>3.1.0</maven-clean-plugin.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
<maven-enforcer-plugin.version>3.0.0-M2</maven-enforcer-plugin.version>
<maven-failsafe-plugin.version>2.22.2</maven-failsafe-plugin.version>
<maven-help-plugin.version>3.2.0</maven-help-plugin.version>
<maven-install-plugin.version>2.5.2</maven-install-plugin.version>
<maven-invoker-plugin.version>3.2.0</maven-invoker-plugin.version>
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
<maven-pmd-plugin.version>3.12.0</maven-pmd-plugin.version>
<maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
<maven-shade-plugin.version>3.2.3</maven-shade-plugin.version>
<maven-site-plugin.version>3.9.0</maven-site-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<maven-war-plugin.version>3.2.3</maven-war-plugin.version>
<!-- ========================================================
Codehaus Plugins Versions
========================================================= -->
<build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version>
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
<flatten-maven-plugin.version>1.2.2</flatten-maven-plugin.version>
<versions-maven-plugin.version>2.7</versions-maven-plugin.version>
<xml-maven-plugin.version>1.0.2</xml-maven-plugin.version>
<!-- ========================================================
Deploy Plugins
========================================================= -->
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
<nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
<!-- ========================================================
Other Plugins
========================================================= -->
<duplicate-finder-maven-plugin.version>1.4.0</duplicate-finder-maven-plugin.version>
</properties>
<modules>
<module>h2</module>
<module>hbase</module>
@ -17,4 +147,579 @@
<module>mongodb</module>
<module>elasticsearch</module>
</modules>
<dependencyManagement>
<dependencies>
<!-- 大部分第三方包使用 spring-boot-dependencies 直接管理版本 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- ========================================================
Java Web
========================================================= -->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>${javax.servlet.jsp-api.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl</artifactId>
<version>${javax.servlet.jsp.jstl.version}</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>${javax.mail.version}</version>
</dependency>
<!-- ========================================================
Java Data数据源客户端、ORM、连接池、数据校验
========================================================= -->
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>${curator.version}</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-test</artifactId>
<version>${curator.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>${fastdfs.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>${mybatis-generator.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>${mybatis-spring.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-core</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-extension</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>${mybatis.mapper.version}</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>${mybatis.pagehelper.version}</version>
</dependency>
<dependency>
<groupId>p6spy</groupId>
<artifactId>p6spy</artifactId>
<version>${p6spy.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate-validator.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>${hbase.version}</version>
</dependency>
<!-- ========================================================
序列化 / JavaBean
========================================================= -->
<dependency>
<groupId>com.github.dozermapper</groupId>
<artifactId>dozer-core</artifactId>
<version>${dozer.version}</version>
</dependency>
<dependency>
<groupId>com.github.dozermapper</groupId>
<artifactId>dozer-spring4</artifactId>
<version>${dozer.version}</version>
</dependency>
<dependency>
<groupId>com.github.dozermapper</groupId>
<artifactId>dozer-spring-boot-starter</artifactId>
<version>${dozer.version}</version>
</dependency>
<!--反射工具-->
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>${reflections.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf-java.version}</version>
</dependency>
<dependency>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
<version>${fst.version}</version>
</dependency>
<!-- ========================================================
常用工具集
========================================================= -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>${commons-configuration2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>${commons-collections4.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>${commons-compress.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>${commons-csv.version}</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${commons-fileupload.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>${commons-math3.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>${commons-pool2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>${commons-text.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool.version}</version>
</dependency>
<!-- ========================================================
特殊工具集
========================================================= -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
<version>${disruptor.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-decisiontables</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-templates</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>${jjwt.version}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>${jjwt.version}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>${jjwt.version}</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>${jsoup.version}</version>
</dependency>
<dependency>
<groupId>org.mvel</groupId>
<artifactId>mvel2</artifactId>
<version>${mvel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.ui}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.ui}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations.version}</version>
</dependency>
<dependency>
<groupId>com.spring4all</groupId>
<artifactId>swagger-spring-boot-starter</artifactId>
<version>${swagger-spring-boot-starter.version}</version>
</dependency>
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>${thumbnailator.version}</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>${zxing.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>${easyexcel.version}</version>
</dependency>
<!--java文件解析工具-->
<dependency>
<groupId>com.github.javaparser</groupId>
<artifactId>javaparser-symbol-solver-core</artifactId>
<version>${javaparser.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter.version}</version>
</dependency>
<!-- ========================================================
Hadoop Client
========================================================= -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-auth</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>${hadoop.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<artifactId>jsr305</artifactId>
<groupId>com.google.code.findbugs</groupId>
</exclusion>
<exclusion>
<artifactId>nimbus-jose-jwt</artifactId>
<groupId>com.nimbusds</groupId>
</exclusion>
<exclusion>
<artifactId>curator-client</artifactId>
<groupId>org.apache.curator</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<!-- ========================================================
Apache Plugins
========================================================= -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven-antrun-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven-assembly-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven-clean-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-dependency-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${maven-enforcer-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>${maven-help-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>${maven-install-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>${maven-invoker-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${maven-pmd-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${maven-shade-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${maven-site-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
</plugin>
<!-- ========================================================
Codehaus Plugins
========================================================= -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${build-helper-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>${flatten-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>${versions-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>${xml-maven-plugin.version}</version>
</plugin>
<!-- ========================================================
Other Plugins
========================================================= -->
<plugin>
<groupId>org.basepom.maven</groupId>
<artifactId>duplicate-finder-maven-plugin</artifactId>
<version>${duplicate-finder-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>