本文参考 https://blog.csdn.net/Ser_Bad/article/details/78433340

经过实战一次通过。回话不多说,话费不多说,直接上图。

项目整体结构:

父模块:
<?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>com.quark</groupId>
<artifactId>quark-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging> <!--管理所有的模块-->
<modules>
<module>quark-admin</module>
<module>quark-chat</module>
<module>quark-common</module>
<module>quark-portal</module>
<module>quark-rest</module>
</modules> <!-- 集中定义依赖版本号与基本配置 -->
<properties>
<!--指定jdk的版本为1.8,默认为1.6-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties> <dependencyManagement>
<dependencies>
      省略其他公共包
</dependencies>
</dependencyManagement> <!--指定使用maven打包-->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests> <!--默认关掉单元测试 -->
</configuration>
</plugin>
</plugins>
</build>
</project>

admin模块:

<?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> <!--指定父模块,需要注意的是,这里要指定父模块pom.xml的相对路径-->
<parent>
<artifactId>quark-parent</artifactId>
<groupId>com.quark</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent> <groupId>com.quark</groupId>
<artifactId>quark-admin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging> <dependencies>
省略导包
</dependencies>
<!--spring boot打包的话需要指定一个唯一的入门-->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- 指定该Main Class为全局的唯一入口 -->
<mainClass>com.quark.admin.AdminApplication</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中-->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build> </project>
其他模块都是一致的配置

如果有公共模块不需要打包
<?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">
<parent>
<artifactId>quark-parent</artifactId>
<groupId>com.quark</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent> <modelVersion>4.0.0</modelVersion> <groupId>com.quark</groupId>
<artifactId>quark-common</artifactId>
<version>1.0-SNAPSHOT</version> <dependencies>
...........
</dependencies> </project>

  

打包

按照上面的配置好以后,执行下面的命令就好了

mvn clean package

上面的命令是打包所以,如果要单个打包用下面的命令

mvn -pl quark-admin -am install

Spirng boot maven多模块打包不踩坑的更多相关文章

  1. spring boot maven多模块打包部署到tomcat

    @SpringBootApplication(scanBasePackages = {"com.xxx.*"}) public class ApiApplication exten ...

  2. Spirng boot maven多模块

    https://blog.csdn.net/Ser_Bad/article/details/78433340

  3. spring boot & maven 多模块 ---心得

    1.前言 有个名字叫 多模块企业级项目  ,其实就是一个父级maven工程里面有着多个子级maven工程的项目 ,甚至在子级maven 里面还有多个子级maven, 这用到了 maven多模块开发的使 ...

  4. 解决IDEA maven多模块打包问题

    参考: https://www.jianshu.com/p/37c6688c4fcb https://blog.csdn.net/sjhuangx/article/details/71519066 h ...

  5. Spring boot redis自增编号控制 踩坑

    近段期间,公司 接手一个订单号生成服务,规则的话已经由项目经理他们规定好了,主要是后面的四位数代表的关于当前订单号已经执行第几个了.而这里面有一个要求就是支持分布式.为了实现这个东西,刚开始我使用了r ...

  6. 【nodejs代理服务器二】nodejs webpack打包配置踩坑总结

    接着上篇用Nodejs开发web代理,防止web渗透.如果部署到正式环境,需要进行打包配置. 我在用webpack打包配置中遇到了几个错误,总结如下: webpack环境变量问题 https://ww ...

  7. Unity打包IOS踩坑记

    1. Xcode不显示模拟器 之前一直用真机调试,就没注意模拟器.今天要上传版本要用到模拟器截图,发现竟然Xcode的运行选项竟然没有显示模拟器. 也是网上找了各种方法,修改各种设置,清了各种文件夹都 ...

  8. Spring Boot 项目实战(一)Maven 多模块项目搭建

    一.前言 最近公司项目准备开始重构,框架选定为 Spring Boot ,本篇主要记录了在 IDEA 中搭建 Spring Boot Maven 多模块项目的过程. 二.软件及硬件环境 macOS S ...

  9. spring boot +dubbo 踩坑记录

    今天初次搭建spring boot +duboo的demo.记录一下踩坑记录. 首先搭建3个小demo,一个maven项目,两个spring boot (服务提供者和服务消费者)项目. 两 sprin ...

随机推荐

  1. java的回调

    java的回调 1,明确什么是回调方法 2,采用接口来实现回调 java同步回调 一个类实现了接口,将他传递给另一个类,在另一个类调用接口中方法 public class Bar implements ...

  2. linux命令之netstat

    功能:打印网络连接.路由表.接口统计信息.伪装连接和多播成员 参数 -r 显示路由表 -i 显示接口表 -n 不解析名字 -p 显示程序名 PID/Program -l 显示监听的 socket -a ...

  3. day22 Pythonpython 本文xml模块

    一.xml介绍 xml是实现不同语言或者程序直接进行数据交换的协议,跟json差不多,单json使用起来更简单.不过现在还有很多传统公司的接口主要是xml xml跟html都是标签语言 我们主要学习的 ...

  4. JS中navigator对象详解

    <code class="language-html"><!doctype html> <html> <head> <meta ...

  5. nginx+tomcat9+redisson+redis+jdk1.8简单实现session共享

    一.环境安装 由于资源限制,在虚拟机中模拟测试,一台虚拟机,所有软件均安装到该虚拟机内 安装系统:CentOS Linux release 7.4.1708 (Core) CentOS安装选择版本:B ...

  6. permute

    repmat函数用法 复制和平铺矩阵   函数repmat 格式:  B = repmat(A, m, n) %将矩阵A复制m*n块,即B由m*n块A平铺而成 B = repmat(A, [m n]) ...

  7. Echo团队Alpha冲刺随笔 - 第五天

    项目冲刺情况 进展 前端:布局,内容等方面基本完成. 后端:基本功能基本实现. 计划:准备进行前后端对接,进行测试 问题 有部分代码冗余,需要着手修改 心得 团队分工明确,互相协作,开发进度比预想的要 ...

  8. C#理解AutoResetEvent和ManualResetEvent

    当在C#使用多线程时就免不了使用AutoResetEvent和ManualResetEvent类,可以理解这两个类可以通过设置信号来让线程停下来或让线程重新启动,其实与操作系统里的信号量很相似(汗,考 ...

  9. git pull 解决 refusing to merge unrelated histories 错误

    解决办法: 1.cmd进入项目的根目录. 2.执行下面的命令:git pull origin master --allow-unrelated-histories.可以提交成功. 3.再次push.

  10. BZOJ1283 序列 网络流区间覆盖模型

    就是区间覆盖模型的费用流版. 区间覆盖模型