maven多个子项目如何打包?

article/2025/10/10 23:50:16

两种方式: 

第一种方式:

                父模块pom 不配置任何打包命令;

                子模块(资源pom) 指定这个pom是资源类型;

                子模块(服务pom) 指定这个pom是java服务类型;

1. 前提: 

maven对应多个子项目, 每个子项目都是一个单独运行的jar包

2. 项目结构:     

五个 jar包; 一个common资源包

3. 思路:

common 作为这五个jar的外部资源

五个jar单独导报

4: 配置

父级pom配置: 不可以加这个! 不可以加! 不可以加!

    <build><plugins><plugin><!-- 父级pom 不要加这个 --><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build>

 common-pom配置: 加资源配置

    <build><plugins><!-- 资源文件拷贝插件 , 指定common 是资源, 不需要被打包, 谁(jar)用谁引用--><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-resources-plugin</artifactId><configuration><encoding>UTF-8</encoding></configuration></plugin></plugins></build>

 子项目-pom配置: 指定打包和main入口

    <build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><mainClass>com.a.b.Main(main方法启动类路径)</mainClass></configuration><executions><execution><goals><goal>repackage</goal></goals></execution></executions></plugin></plugins></build>

 5: 打包

在父-pom的路径下使用这个命令:

#在父级pom的路径下#打包
mvn clean package -Dmaven.test.skip=true

6: 去子项目的target目录下找对应的 *.jar包 

第二种方式:

                父级pom使用 'maven-compiler-plugin' 工具打包;

                子模块(资源类型): 不需要配置pom文件, 但是要把子模块依赖到 父模块的pom中;

                子模块(java类型): 需要配置pom文件: 'spring-boot-maven-plugin', 同时挂在父pom中;

1. 项目背景:

        

2. 介绍

上面的服务分两种:

        common: 就是各种资源

        modules: 就是各种jar包

3. 配置

        父级(最大的那个pom)配置如下

    <build><finalName>${project.artifactId}</finalName><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><executions><execution><goals><goal>repackage</goal></goals></execution></executions></plugin></plugins></build>

        同时把common下面的子包 和 modules下面的子包 都给 引入到父级pom(最大的那个pom)

如下:

4.  修改需要运行的jar类型子pom

 

    <build><finalName>${project.artifactId}</finalName><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><executions><execution><goals><goal>repackage</goal></goals></execution></executions></plugin></plugins></build>

 


http://chatgpt.dhexx.cn/article/3W9DIqYs.shtml

相关文章

maven项目常用的打包方式

一、无依赖其他任何jar <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> <configuration> <archive>…

IDEA中MAVEN项目如何打包JAR包

这篇文章主要为大家展示了“IDEA中MAVEN项目如何打包JAR包”&#xff0c;内容简而易懂&#xff0c;条理清晰&#xff0c;希望能够帮助大家解决疑惑&#xff0c;下面让小编带领大家一起研究并学习一下“IDEA中MAVEN项目如何打包JAR包”这篇文章吧。 Idea中为一般的非Web项目打J…

Maven项目打包为jar的几种方式

Maven项目打包为jar的几种方式 这里收集整理下以往打包MAVEN项目为JAR包的各种方式 ##直接打包&#xff0c;不打包依赖包 直接打包&#xff0c;不打包依赖包&#xff0c;仅打包出项目中的代码到JAR包中。在POM中添加如下plugin即可&#xff0c;随后执行maven install <plu…

mac电脑如何图片压缩优化,附教程

mac电脑如何将图片无损压缩且优化&#xff1f;今天小编给大家带来一款软件ImageOptim这款小巧免费且开源的Mac 图片无损压缩优化工具。如何工作下面给大家介绍ImageOptim for mac图片压缩优化教程。 标题ImageOptim图片压缩优化软件使用教程 当你拖放图片到ImageOptim的窗口&…

Image augmentation library in Python-Augmentor使用心得

Augmentor是个增强图像训练数据的库&#xff0c;减少了使用图像库自己编写代码的繁杂工序&#xff0c;能够批量完成图像的旋转&#xff0c;放大&#xff0c;缩小&#xff0c;添加噪音以扩充数据量。接下来结合官方文档介绍下这个库和使用心得。 首先github&#xff1a;https:/…

9.1_image-augmentation

9.1 图像增广 在5.6节&#xff08;深度卷积神经网络&#xff09;里我们提到过&#xff0c;大规模数据集是成功应用深度神经网络的前提。图像增广&#xff08;image augmentation&#xff09;技术通过对训练图像做一系列随机改变&#xff0c;来产生相似但又不同的训练样本&…

ObjectFormer for Image Manipulation Detection and Localization

paper&#xff1a;https://arxiv.org/abs/2203.14681 Abstract 近年来图像编辑技术的发展对多媒体数据的可信度提出了严峻的挑战&#xff0c;这推动了图像篡改检测的研究。在本文中&#xff0c;我们提出了ObjectFormer来检测和定位图像操作。为了捕捉在RGB域中不可见的细微操…

Multimodal Co-Attention Transformer for Survival Prediction in Gigapixel Whole Slide Images

用于千兆像素全切片病理图像生存预测的多模态下跨模态注意机制的transformer 概念&#xff1a; premutation invariance(置换不变&#xff09;&#xff1a;指输入顺序的改变不会影响输出值 permutation-equivariant(置换等边&#xff09;&#xff1a;与premutation invariance …

【Image Captioning】Improve Image Captioning by Estimating the Gazing Patterns from the Caption

Improve Image Captioning by Estimating the Gazing Patterns from the Caption Department of Computer Science, The George Washington University, CVPR 2022 Abstract CNN等神经网络模型中提取的图像特征中产生类人描述方面达到了良好的性能。然而&#xff0c;之前没有…

Image_captioning

Image caption——图像理解 文章目录 Image caption——图像理解1、任务综述以及早期做法2、从Encoder-Decoder结构谈起&#xff08;前身&#xff09;3、Show and Tell: A Neural Image Caption Generator&#xff08;image caption 开山之作&#xff09; 1、任务综述以及早期做…

From Image to Imuge: Immunized Image Generation

From Image to Imuge: Immunized Image Generation Brief Introduction of myselfIntroduction of this workRelated WorksImage Self-EmbeddingImage Reconstruction (Inpainting) MethodExperimentsConclusion and Contact Brief Introduction of myself 大家好&#xff0c;…

PhotometricStereo

PhotometricStereo 小强老师留下了道CMU的习题&#xff0c;见此题十分有趣&#xff0c;而且博客许久不曾更新&#xff0c;特把该作业奉上。作业是CV中的Photometric Stereo方面的&#xff0c;基本原理还是视觉领域的复原建模&#xff0c;详见这篇论文&#xff1a; Aaron Hertzm…

Free-Form Image Inpainting with Gated Convolution

CVPR 2020的一篇文章 解读一下题目&#xff1a; - free form 自由形式 - image inpainting 图像补全 - gated convolution 门控卷积该文章提出了一个&#xff0c;缺失区域为自由形式的图像补全情况的解决方法&#xff0c;针对该方法提出了一个门控卷积的方法。 模型结构图…

Deep Image Prior

Deep Image Prior 摘要 深度卷积网络已经成为图像生成和重建的常用工具。人们猜想&#xff0c;他们优秀的表现是归功于他们能够从大量图像样本中学习到真实图像先验的能力。而相反&#xff0c;本文中作者展示生成网络在经过任何学习之前就能够捕获大量的低级图像统计信息&…

Automatic Trimap Generation for Image Matting

Automatic Trimap Generation for Image Matting翻译 Abstract image matting 是计算摄影中的一个重要问题。虽然已经研究了二十多年&#xff0c;但是开发一种不需要人工干预的自动matting算法仍然是一个挑战。大多数最先进的matting算法都需要人工干预&#xff0c;以trimap或涂…

Self-augmented Unpaired Image Dehazing via Density and Depth Decomposition程序运行记录

论文题目&#xff1a; 《Self-augmented Unpaired Image Dehazing via Density and Depth Decomposition》 作者列表&#xff1a; 杨洋(天津大学)&#xff0c;王超岳&#xff08;悉尼大学&#xff09;&#xff0c;刘日升&#xff08;大连理工大学&#xff09;&#xff0c;张…

Learning Continuous Image Representation with Local Implicit Image Function

1. 简介 文章简称为LIIF&#xff0c;即Local Implicit Image Function&#xff0c;受到了3D视觉里场景或物体的隐式表示思想的启发&#xff0c;主要的想法便是把正常的图像当做是连续的&#xff0c;用神经网络表示这个图像之后&#xff0c;对于图像上的每一个像素点其实就当做…

【InternImage】Exploring Large-Scale Vision Foundation Models with Deformable Convolutions

基于Deformable Conv的大规模基础模型 特点&#xff1a; 采用Deformable Conv V3 【v2 19论文】CNN模型 背景 大规模的ViT模型借助模型能力在超大规模数据集上取得了非常高的性能&#xff0c;然而大规模CNN模型研究才刚刚开始。 近期CNN研究倾向于使用大的卷积kernel&#…

ImageMol

ai圈也是卷的狠啊~~ 又发现一个全球首个分子图像自监督学习框架来也 分子是维持物质化学稳定性的最小单位。对分子的研究&#xff0c;是药学、材料学、生物学、化学等众多科学领域的基础性问题。 分子的表征学习&#xff08;Molecular Representation Learning&#xff09;是…

Morphological image processing

目录 基本思想&#xff1a; 一.集合论基础 1.集合的概念 2.集合间的关系和运算 二.二值形态学的基本运算 1.腐蚀 &#xff08;1&#xff09;概念 &#xff08;2&#xff09;结构元素形状对腐蚀运算结果的影响 &#xff08;3&#xff09;腐蚀运算在物体识别中的应用 2…