发布时间:2026/7/9 7:37:04
Maven POM 标签说明 Maven POM 标签完整参考手册目录一、根标签二、项目基本信息三、父 POM 继承四、属性配置五、依赖管理六、模块管理七、构建配置八、分发管理九、仓库配置十、常用插件配置示例一、根标签标签说明示例projectPOM 文件的根元素所有配置都包裹在里面project xmlns...modelVersionPOM 模型的版本Maven 2/3 固定为 4.0.0modelVersion4.0.0/modelVersion二、项目基本信息标签说明示例groupId项目所属的组织/公司 ID通常使用反转的域名groupIdnet.iuyy.agent/groupIdartifactId项目的唯一标识符也是构建产物的名称artifactIdagent-core/artifactIdversion项目版本号SNAPSHOT 表示快照版本version1.0-SNAPSHOT/versionpackaging打包方式可选pom、jar、war、ear、maven-plugin等packagingjar/packagingname项目的显示名称可选nameAgent Core/namedescription项目描述可选description核心代理模块/descriptionurl项目主页 URL可选urlhttp://www.iuyy.net/url三、父 POM 继承标签说明示例parent定义父 POM继承其配置parent.../parentparent/groupId父项目的 groupIdgroupIdnet.iuyy.agent/groupIdparent/artifactId父项目的 artifactIdartifactIdagent-platform/artifactIdparent/version父项目的版本号version1.0/versionparent/relativePath父 POM 的相对路径默认../pom.xml空值表示从仓库查找relativePath../pom.xml/relativePathparent/relativePath/空标签表示不从本地查找直接去仓库relativePath/四、属性配置标签说明示例properties定义可复用的属性变量properties.../propertiesjava.version自定义属性在 POM 中用${java.version}引用java.version17/java.versionproject.build.sourceEncoding源码编码project.build.sourceEncodingUTF-8/project.build.sourceEncodingproject.reporting.outputEncoding报告输出编码project.reporting.outputEncodingUTF-8/project.reporting.outputEncodingmaven.compiler.source编译源码的 Java 版本maven.compiler.source17/maven.compiler.sourcemaven.compiler.target编译目标 Java 版本maven.compiler.target17/maven.compiler.targetmaven.compiler.encoding编译编码maven.compiler.encodingUTF-8/maven.compiler.encoding五、依赖管理5.1dependencies- 直接依赖标签说明示例dependencies所有依赖的根容器dependencies.../dependenciesdependency单个依赖项dependency.../dependencydependency/groupId依赖的组织 IDgroupIdorg.springframework.boot/groupIddependency/artifactId依赖的构件 IDartifactIdspring-boot-starter-web/artifactIddependency/version依赖的版本号version3.5.10/versiondependency/type依赖的类型默认jartypejar/typedependency/scope依赖作用域scopecompile/scopedependency/optional是否可选依赖不传递optionaltrue/optionaldependency/classifier分类器用于区分相同版本的不同构建classifierexec/classifierdependency/exclusions排除传递性依赖exclusions.../exclusionsdependency/exclusions/exclusion单个排除项exclusion.../exclusion5.2dependencyManagement- 依赖版本管理标签说明示例dependencyManagement管理依赖版本子模块继承但不会自动引入dependencyManagement.../dependencyManagementdependencyManagement/dependencies同dependencies同dependencies5.3 Scope 作用域Scope说明生效阶段compile默认所有阶段都可用编译、测试、运行provided由 JDK 或容器提供打包时不包含编译、测试runtime运行时需要编译时不需要测试、运行test仅测试阶段需要测试system系统本地路径不推荐使用编译、测试import仅用于 dependencyManagement导入 BOM版本管理六、模块管理多模块项目标签说明示例modules子模块列表容器modules.../modulesmodule子模块的相对路径目录名moduleagent-core/module七、构建配置7.1build基本结构标签说明示例build构建配置的根容器build.../buildbuild/finalName构建产物的最终名称finalNameagent-web/finalNamebuild/directory构建输出目录默认targetdirectorytarget/directorybuild/sourceDirectory源码目录默认src/main/javasourceDirectorysrc/main/java/sourceDirectorybuild/testSourceDirectory测试源码目录testSourceDirectorysrc/test/java/testSourceDirectorybuild/outputDirectory编译输出目录outputDirectorytarget/classes/outputDirectorybuild/testOutputDirectory测试编译输出目录testOutputDirectorytarget/test-classes/testOutputDirectory7.2resources- 资源文件标签说明示例resources资源列表容器resources.../resourcesresource单个资源配置resource.../resourceresource/directory资源目录directorysrc/main/resources/directoryresource/includes包含的文件模式includes.../includesresource/excludes排除的文件模式excludes.../excludesresource/filtering是否启用资源过滤替换变量filteringtrue/filtering7.3plugins- 插件配置标签说明示例plugins插件列表容器plugins.../pluginsplugin单个插件配置plugin.../pluginplugin/groupId插件组织 IDgroupIdorg.springframework.boot/groupIdplugin/artifactId插件构件 IDartifactIdspring-boot-maven-plugin/artifactIdplugin/version插件版本version3.5.10/versionplugin/extensions是否扩展 Maven 核心功能extensionstrue/extensionsplugin/configuration插件配置参数configuration.../configurationplugin/executions插件执行目标executions.../executionsplugin/executions/execution单个执行配置execution.../executionexecution/id执行 IDidrepackage/idexecution/goals执行的目标列表goals.../goalsexecution/goal单个目标goalrepackage/goalexecution/phase绑定的生命周期阶段phasepackage/phaseexecution/configuration该执行的特定配置configuration.../configuration7.4pluginManagement- 插件版本管理标签说明示例pluginManagement管理插件版本子模块继承但不会自动执行pluginManagement.../pluginManagementpluginManagement/plugins同plugins同plugins八、分发管理标签说明示例distributionManagement分发配置distributionManagement.../distributionManagementrepository发布仓库repository.../repositorysnapshotRepository快照仓库snapshotRepository.../snapshotRepositorysite站点部署配置site.../site九、仓库配置标签说明示例repositories远程仓库列表repositories.../repositoriesrepository单个仓库repository.../repositoryrepository/id仓库 IDidaliyun/idrepository/name仓库名称nameAliyun Maven/namerepository/url仓库地址urlhttps://maven.aliyun.com/.../urlrepository/snapshots快照版本策略snapshots.../snapshotsrepository/releases正式版本策略releases.../releases十、常用插件配置示例10.1 Spring Boot Maven PluginplugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactIdconfigurationskipfalse/skip!-- 是否跳过 repackage --mainClasscom.example.Application/mainClass!-- 启动类 --classifierexec/classifier!-- 生成带后缀的 jar --jvmArguments!-- JVM 参数 --jvmArgument-Dfile.encodingUTF-8/jvmArgument/jvmArgumentssystemPropertyVariables!-- 系统属性 --file.encodingUTF-8/file.encoding/systemPropertyVariablesarguments!-- 应用参数 --argument--server.port8080/argument/argumentsexcludes!-- 排除依赖 --excludegroupIdorg.projectlombok/groupIdartifactIdlombok/artifactId/exclude/excludes/configurationexecutionsexecutiongoalsgoalrepackage/goal!-- 重打包目标 --/goals/execution/executions/plugin10.2 Maven Compiler PluginplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-compiler-plugin/artifactIdconfigurationsource17/source!-- 源码版本 --target17/target!-- 目标版本 --encodingUTF-8/encoding!-- 编码 --compilerArgs!-- 额外参数 --arg-parameters/arg!-- 保留参数名 --arg-Xlint:unchecked/arg!-- 警告级别 --/compilerArgs/configuration/plugin10.3 Maven Surefire Plugin测试plugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-surefire-plugin/artifactIdconfigurationskipTeststrue/skipTests!-- 跳过测试 --includes!-- 包含的测试类 --include**/*Test.java/include/includesexcludes!-- 排除的测试类 --exclude**/*IntegrationTest.java/exclude/excludesforkCount4/forkCount!-- 并行测试数 --reuseForkstrue/reuseForks!-- 复用 fork --/configuration/plugin10.4 Maven Jar PluginplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-jar-plugin/artifactIdconfigurationexcludes!-- 排除文件 --exclude**/application-dev.yml/exclude/excludesarchivemanifestaddClasspathtrue/addClasspath!-- 添加 Classpath --mainClasscom.example.Application/mainClass!-- 主类 --/manifestmanifestEntries!-- 自定义 Manifest --Implementation-Version${project.version}/Implementation-Version/manifestEntries/archive/configuration/plugin10.5 Maven Source PluginplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-source-plugin/artifactIdexecutionsexecutionidattach-sources/idphasepackage/phasegoalsgoaljar-no-fork/goal!-- 生成源码 jar --/goals/execution/executions/plugin

相关新闻

2026/7/9 6:37:03

【期刊推荐】Elsevier旗下5本非OA免费中科院2区SCI期刊,海洋/中医药/材料/计算机/综合性多学科全覆盖,无版面费,审稿周期透明,自引安全、录用友好,硕博/毕业评职优选,各学科科研人收藏!

不少课题组、在读硕博被 OA 期刊高昂版面费压力困扰,动辄上万发表成本大幅增加科研经费负担,很多高分 2 区期刊其实提供传统订阅非 OA 模式,全程无需版面费。本文整理5 本覆盖中医药、电气、海洋、材料、综合交叉学科的中科院 2 区 SCI&#…

2026/7/9 6:37:03

AI Scaffold 的整体架构设计:一个 AI 应用脚手架应该包含什么?

AI Scaffold 的整体架构设计:一个 AI 应用脚手架应该包含什么?摘要:AI 应用脚手架不只是生成几个目录,也不只是封装一次模型调用。它更像一个工程化起点,需要提前规划项目模板、配置系统、LLM 抽象、Workflow、Agent、…

2026/7/9 10:56:21

P1902 刺杀大使(二分+BFS)

P1902 刺杀大使 https://www.luogu.com.cn/problem/P1902 二分BFS 二分是对单调区间的快速枚举,当出现关键词“最大”“最小”时使用。 在二分的基础上就是Check,验证答案是否合法。 本题是一个矩阵,涉及到对dfs和bfs的选择。 DFS递归实现…

2026/7/9 10:56:21

好用的书房书柜整木高定品牌

开篇引言根据《2026年中国全屋定制行业发展报告》显示,珠三角全屋定制市场规模同比增长38%,其中全屋高端定制细分市场同比增长52%。深圳本土家庭全屋定制需求占比72%,高端定制需求占比45%。在这样的市场环境下,越来越多的深圳消费…

2026/7/9 10:51:21

ES2026,早该这样了

“Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away.” — Antoine de Saint-Exupry6月30号,ECMAScript 2026 的规范悄悄过审了。 没有发布会,没有倒计时,连个热搜都没上。说实话…

2026/7/9 1:39:10

国内大模型选型与企业级落地实战指南

我不能提供任何关于访问境外网络信息的技术方案或变通方法。根据中国法律法规和网络管理要求,所有互联网服务必须遵守国家关于网络安全、数据安全和内容安全的规定。ChatGPT及其后续版本(如所谓“GPT-5”)是由境外机构研发的大语言模型&#…

2026/7/9 1:25:56

三步实战方案:高效获取智慧教育平台电子课本PDF的完整流程

三步实战方案:高效获取智慧教育平台电子课本PDF的完整流程 【免费下载链接】tchMaterial-parser 国家中小学智慧教育平台 电子课本下载工具,帮助您从智慧教育平台中获取电子课本的 PDF 文件网址并进行下载,让您更方便地获取课本内容。 项目…

2026/7/9 0:37:00

高精度ADC与STM32L4在工业测量中的优化设计

1. 项目背景与核心器件选型在工业测量和精密仪器领域,模拟信号与数字系统的无缝衔接一直是设计难点。ADS1262作为TI推出的32位精密Δ-Σ ADC,其7nV RMS噪声和3ppm线性度指标,配合STM32L442KC的低功耗特性,构成了理想的信号链解决方…

2026/7/9 0:37:00

ADS1262与STM32F446ZE的高精度数据采集系统设计

1. 为什么需要弥合模拟与数字领域的鸿沟?在嵌入式系统开发中,模拟信号与数字信号的处理一直是个经典难题。我最近在一个工业传感器项目中,就深刻体会到了这种"跨界"处理的挑战。当时需要测量多路微伏级电压信号,同时还要…

2026/7/9 0:37:00

【SpringCloud Alibaba】Spring Boot + Spring Cloud 微服务面试核心20问

大家好,我是 CodeStats。一个在底层技术上“考古”了四年的硬核爱好者,也是 WWAIC(全周项目AI编程) 范式的提出者和实践者。我曾手写过一个完整的 Java Web 框架(从 IoC 容器到嵌入式 Tomcat,代码全开源&a…

2026/7/9 5:30:41

3个高效策略:快速掌握Axure中文界面配置

3个高效策略:快速掌握Axure中文界面配置 【免费下载链接】axure-cn Chinese language file for Axure RP. Axure RP 简体中文语言包。支持 Axure 11、10、9。不定期更新。 项目地址: https://gitcode.com/gh_mirrors/ax/axure-cn 还在为Axure RP的英文界面感…