使用spring boot全家桶打造微服务基础架构-1【创建基础
2018-11-11 本文已影响118人
邪影oO
本篇是《使用spring boot全家桶打造微服务基础架构》系列的第二篇
本篇收费的原因在上一篇中已经提到过,不愿意付费也没关系,本篇内容不算重要
本篇中,我们创建几个基础工程,先创建一个文件夹: black-start, 在该文件夹中,我们创建如下几个文件夹和文件
black-start-base
这是基础工程,主要用于控制各个jar包的版本号, 在文件夹中创建 pom.xml文件,内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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>
<groupId>top.klw8.blackStart</groupId>
<artifactId>black-start-base</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>haige-java-base</name>
<description>black-start-base项目,主要用于控制各个jar包的版本号</description>
<properties>
<project.build.jdkVersion>1.8</project.build.jdkVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<skipJunitTest>true</skipJunitTest>
<spring-cloud.version>Finchley.SR1</spring-cloud.version>
<rocketmq-client.version>4.3.1</rocketmq-client.version>
<junit5-platform.version>1.3.1</junit5-platform.version>
<disruptor.version>3.4.2</disruptor.version>
<aviator.version>3.3.0</aviator.version>
<commons-io.version>2.6</commons-io.version>
<commons-beanutils.version>1.9.3</commons-beanutils.version>
<commons-collections.version>4.2</commons-collections.version>
<aliyun-sdk-oss.version>3.3.0</aliyun-sdk-oss.version>
<commons-fileupload.version>1.3.3</commons-fileupload.version>
<elasticsearch-rest-high-level-client.version>6.2.3</elasticsearch-rest-high-level-client.version>
<springfox.version>2.7.0</springfox.version>
<zookeeper.version>3.4.13</zookeeper.version>
<xxl-job.version>1.9.2</xxl-job.version>
<spring-boot-starter-rocketmq-version>1.0.2</spring-boot-starter-rocketmq-version>
<commons-text.version>1.6</commons-text.version>
<spring-security-jwt.version>1.0.9.RELEASE</spring-security-jwt.version>
<spring-security-oauth2.version>2.3.4.RELEASE</spring-security-oauth2.version>
<haige-service-api.version>0.0.1-SNAPSHOT</haige-service-api.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
<relativePath/>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
<version>${spring-security-jwt.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>${spring-security-oauth2.version}</version>
</dependency>
<!-- xxl-job-core -->
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>${xxl-job.version}</version>
</dependency>
<dependency>
<groupId>com.haige</groupId>
<artifactId>haige-service-api</artifactId>
<version>${haige-service-api.version}</version>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>${zookeeper.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox.version}</version>
</dependency>
<dependency>
<groupId>com.haige</groupId>
<artifactId>haige-java-commons</artifactId>
<version>${project.version}</version>
</dependency>
<!-- rocketmq 远程 日志支持,已经自带rocketmq的client -->
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-logappender</artifactId>
<version>${rocketmq-client.version}</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit5-platform.version}</version>
<scope>test</scope>
</dependency>
<!-- log4j 2 的异步日志依赖包-->
<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
<version>${disruptor.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.aviator</groupId>
<artifactId>aviator</artifactId>
<version>${aviator.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>${commons-beanutils.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>${commons-collections.version}</version>
</dependency>
<!-- 阿里云oss -->
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>${aliyun-sdk-oss.version}</version>
</dependency>
<!-- 文件上传组件 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${commons-fileupload.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>${elasticsearch-rest-high-level-client.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch-rest-high-level-client.version}</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>spring-boot-starter-rocketmq</artifactId>
<version>${spring-boot-starter-rocketmq-version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>${commons-text.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- rocketmq 远程 日志支持,已经自带rocketmq的client -->
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-logappender</artifactId>
</dependency>
<!-- junit5 -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-console-standalone</artifactId>
<version>${junit5-platform.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<!-- log4j 1 迁移 2 的包 -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
</dependency>
<!-- slf4j 使用 log4j 2的实现 ,相关jar一起就引入了-->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</dependency>
<!--commons-logging替换成slf4j-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
<!-- log4j 2 的异步日志依赖包-->
<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
</dependency>
<!-- AOP -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
</dependency>
<dependency>
<groupId>com.googlecode.aviator</groupId>
<artifactId>aviator</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
<!-- commons-lang -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${project.build.jdkVersion}</source>
<target>${project.build.jdkVersion}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<compilerArguments>
<verbose />
<bootclasspath>${rrl-bootclasspath}</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>${skipJunitTest}</skip>
</configuration>
</plugin>
</plugins>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<testResource>
<directory>${basedir}/src/test/resources</directory>
</testResource>
</testResources>
</build>
<repositories>
<repository>
<id>nexus-aliyun</id>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<profile.active>dev</profile.active>
<log.rocketMQ.address>127.0.0.1:9876</log.rocketMQ.address>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<profile.active>test</profile.active>
<log.rocketMQ.address>127.0.0.1:9876</log.rocketMQ.address>
</properties>
</profile>
</profiles>
</project>