以更新gihub地址,为了铺垫springcloud,得先清楚springboot多模块项目搭建。
往后更新spark,springcloud,hadoop。
现在SpringBoot越来越流行,其配置少的特点,让我们不论是做传统Web还是微服务都青睐于SpringBoot
这里阐述一下 SpringBoot 多模块用maven搭建+H2测试+maven profile
最近做了简化没有分那么多module
地址:https://github.com/hui-base-springboot/
分支:master
<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.0modelVersion>
<groupId>com.hui.basegroupId>
<artifactId>hui-base-springbootartifactId>
<packaging>pompackaging>
<version>1.0.0-SNAPSHOTversion>
<modules>
<module>hui-base-springboot-modelmodule>
<module>hui-base-springboot-servermodule>
<module>hui-base-springboot-restmodule>
<module>hui-base-springboot-commonmodule>
modules>
<parent>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-parentartifactId>
<version>2.0.3.RELEASEversion>
parent>
<description>
root的pom.xml 其他多个子模块公用的包可以在这里引入 子模块引用这些JAR包则不需要填写VERSION
description>
<properties>
<project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
<java.version>1.8java.version>
<mybatis.spring.boot.starter.version>1.3.0mybatis.spring.boot.starter.version>
<commons.lang3.version>3.6commons.lang3.version>
<swagger2.version>2.7.0swagger2.version>
<mybatis.generator>1.3.7mybatis.generator>
<postgresql.version>9.4.1212postgresql.version>
<h2.version>1.4.197h2.version>
<pagehelper.version>1.2.7pagehelper.version>
<quartz.version>2.2.3quartz.version>
<fastjson.version>1.2.39fastjson.version>
<poi.version>3.17poi.version>
<logback.version>1.1.11logback.version>
<druid.version>1.1.10druid.version>
properties>
<profiles>
<profile>
<id>devid>
<properties>
<activatedProperties>devactivatedProperties>
properties>
<activation>
<activeByDefault>trueactiveByDefault>
activation>
profile>
<profile>
<id>testid>
<properties>
<activatedProperties>testactivatedProperties>
properties>
profile>
<profile>
<id>prodid>
<properties>
<activatedProperties>prodactivatedProperties>
properties>
profile>
profiles>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>ch.qos.logbackgroupId>
<artifactId>logback-classicartifactId>
<version>${logback.version}version>
dependency>
<dependency>
<groupId>org.mybatis.spring.bootgroupId>
<artifactId>mybatis-spring-boot-starterartifactId>
<version>${mybatis.spring.boot.starter.version}version>
dependency>
<dependency>
<groupId>com.h2databasegroupId>
<artifactId>h2artifactId>
<version>${h2.version}version>
<scope>testscope>
dependency>
<dependency>
<groupId>com.alibabagroupId>
<artifactId>fastjsonartifactId>
<version>${fastjson.version}version>
dependency>
<dependency>
<groupId>org.postgresqlgroupId>
<artifactId>postgresqlartifactId>
<version>${postgresql.version}version>
dependency>
<dependency>
<groupId>com.alibabagroupId>
<artifactId>druid-spring-boot-starterartifactId>
<version>${druid.version}version>
dependency>
<dependency>
<groupId>org.apache.poigroupId>
<artifactId>poiartifactId>
<version>${poi.version}version>
dependency>
<dependency>
<groupId>org.apache.poigroupId>
<artifactId>poi-ooxmlartifactId>
<version>${poi.version}version>
dependency>
<dependency>
<groupId>org.apache.commonsgroupId>
<artifactId>commons-lang3artifactId>
<version>${commons.lang3.version}version>
dependency>
<dependency>
<groupId>com.github.pagehelpergroupId>
<artifactId>pagehelper-spring-boot-starterartifactId>
<version>${pagehelper.version}version>
dependency>
<dependency>
<groupId>io.springfoxgroupId>
<artifactId>springfox-swagger2artifactId>
<version>${swagger2.version}version>
dependency>
<dependency>
<groupId>io.springfoxgroupId>
<artifactId>springfox-swagger-uiartifactId>
<version>${swagger2.version}version>
dependency>
<dependency>
<groupId>org.quartz-schedulergroupId>
<artifactId>quartzartifactId>
<version>${quartz.version}version>
dependency>
dependencies>
dependencyManagement>
<distributionManagement>
<repository>
<id>nexus_productionid>
<url>nexus_production URLurl>
repository>
<snapshotRepository>
<id>nexus_snapshotsid>
<url>nexus_snapshots URLurl>
snapshotRepository>
distributionManagement>
project>
<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">
<parent>
<artifactId>com-hui-springbootartifactId>
<groupId>com.hui.springbootgroupId>
<version>0.1.0-SNAPSHOTversion>
parent>
<modelVersion>4.0.0modelVersion>
<description>
common包,通用的工具类等
description>
<artifactId>hui-springboot-commonartifactId>
<name>hui-springboot-commonname>
<version>${project.parent.version}version>
<packaging>jarpackaging>
<dependencies>
<dependency>
<groupId>org.apache.commonsgroupId>
<artifactId>commons-lang3artifactId>
dependency>
<dependency>
<groupId>org.apache.poigroupId>
<artifactId>poiartifactId>
dependency>
<dependency>
<groupId>org.apache.poigroupId>
<artifactId>poi-ooxmlartifactId>
dependency>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-testartifactId>
dependency>
dependencies>
project>
<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.0modelVersion>
<parent>
<artifactId>hui-springbootartifactId>
<groupId>com.hui.springbootgroupId>
<version>0.1.0-SNAPSHOTversion>
parent>
<artifactId>hui-base-springboot-serverartifactId>
<name>hui-base-springboot-servername>
<version>${project.parent.version}version>
<packaging>jarpackaging>
<description>
server包,service
description>
<dependencies>
<dependency>
<groupId>com.base.huigroupId>
<artifactId>hui-base-springboot-commonartifactId>
<version>${project.parent.version}version>
dependency>
<dependency>
<groupId>com.base.huigroupId>
<artifactId>hui-base-springboot-modelartifactId>
<version>${project.parent.version}version>
dependency>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-testartifactId>
dependency>
<dependency>
<groupId>org.mybatis.spring.bootgroupId>
<artifactId>mybatis-spring-boot-starterartifactId>
dependency>
<dependency>
<groupId>ch.qos.logbackgroupId>
<artifactId>logback-classicartifactId>
dependency>
<dependency>
<groupId>org.postgresqlgroupId>
<artifactId>postgresqlartifactId>
dependency>
<dependency>
<groupId>com.h2databasegroupId>
<artifactId>h2artifactId>
<scope>testscope>
dependency>
<dependency>
<groupId>com.alibabagroupId>
<artifactId>druid-spring-boot-starterartifactId>
dependency>
<dependency>
<groupId>com.github.pagehelpergroupId>
<artifactId>pagehelper-spring-boot-starterartifactId>
dependency>
dependencies>
<build>
<plugins>
<plugin>
<groupId>org.mybatis.generatorgroupId>
<artifactId>mybatis-generator-maven-pluginartifactId>
<version>${mybatis.generator}version>
<configuration>
<configurationFile>
${basedir}/src/main/resources/generator/generatorConfig.xml
configurationFile>
<verbose>trueverbose>
<overwrite>trueoverwrite>
configuration>
<dependencies>
<dependency>
<groupId>org.postgresqlgroupId>
<artifactId>postgresqlartifactId>
<version>${postgresql.version}version>
dependency>
<dependency>
<groupId>org.mybatis.generatorgroupId>
<artifactId>mybatis-generator-coreartifactId>
<version>${mybatis.generator}version>
dependency>
dependencies>
plugin>
plugins>
<finalName>hui-base-spring-serverfinalName>
build>
project>
<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">
<parent>
<artifactId>hui-base-springbootartifactId>
<groupId>com.hui.basegroupId>
<version>1.0.0-SNAPSHOTversion>
parent>
<modelVersion>4.0.0modelVersion>
<artifactId>hui-base-springboot-restartifactId>
<description>Controller/API层description>
<version>${project.parent.version}version>
<packaging>jarpackaging>
<properties>
<maven.compiler.source>1.8maven.compiler.source>
<maven.compiler.target>1.8maven.compiler.target>
properties>
<description>
controller,也是构建包的POM
description>
<dependencies>
<dependency>
<groupId>com.base.huigroupId>
<artifactId>hui-base-springboot-serverartifactId>
<version>${project.parent.version}version>
dependency>
<dependency>
<groupId>com.base.huigroupId>
<artifactId>hui-base-springboot-commonartifactId>
<version>${project.parent.version}version>
dependency>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starterartifactId>
dependency>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-webartifactId>
dependency>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-testartifactId>
dependency>
<dependency>
<groupId>io.springfoxgroupId>
<artifactId>springfox-swagger2artifactId>
dependency>
<dependency>
<groupId>io.springfoxgroupId>
<artifactId>springfox-swagger-uiartifactId>
dependency>
<dependency>
<groupId>com.h2databasegroupId>
<artifactId>h2artifactId>
<scope>testscope>
dependency>
<dependency>
<groupId>com.alibabagroupId>
<artifactId>fastjsonartifactId>
dependency>
<dependency>
<groupId>org.quartz-schedulergroupId>
<artifactId>quartzartifactId>
dependency>
dependencies>
<build>
<finalName>hui-base-springboot-back-${project.parent.version}finalName>
<plugins>
<plugin>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-maven-pluginartifactId>
plugin>
plugins>
build>
project>
搭建项目需要跟公司规范挂钩,例如是否有用到NEXUS私有仓库,是否需要源码包,环境的版本等
文章内容并没有困难点,在于自身总结,做一个思考。JAR包版本的选择等。集成一些工具后如何配置好让其生效,并且考虑JAR冲突的因素。
一个宗旨,基础东西,总结! 困难的技术点,总结!困难的使用工具,总结!架构学些,总结!
转载请注明作者感谢~ 自己总结的东西才是自己的