当前位置:   article > 正文

Maven POM元素解析

Maven POM元素解析

这是对Maven中使用的Maven项目描述符的引用。

  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
  3. child.project.url.inherit.append.path=.. >
  4. <modelVersion/>
  5. <parent>
  6. <groupId/>
  7. <artifactId/>
  8. <version/>
  9. <relativePath/>
  10. </parent>
  11. <groupId/>
  12. <artifactId/>
  13. <version/>
  14. <packaging/>
  15. <name/>
  16. <description/>
  17. <url/>
  18. <inceptionYear/>
  19. <organization>
  20. <name/>
  21. <url/>
  22. </organization>
  23. <licenses>
  24. <license>
  25. <name/>
  26. <url/>
  27. <distribution/>
  28. <comments/>
  29. </license>
  30. </licenses>
  31. <developers>
  32. <developer>
  33. <id/>
  34. <name/>
  35. <email/>
  36. <url/>
  37. <organization/>
  38. <organizationUrl/>
  39. <roles/>
  40. <timezone/>
  41. <properties>
  42. <key>value</key>
  43. </properties>
  44. </developer>
  45. </developers>
  46. <contributors>
  47. <contributor>
  48. <name/>
  49. <email/>
  50. <url/>
  51. <organization/>
  52. <organizationUrl/>
  53. <roles/>
  54. <timezone/>
  55. <properties>
  56. <key>value</key>
  57. </properties>
  58. </contributor>
  59. </contributors>
  60. <mailingLists>
  61. <mailingList>
  62. <name/>
  63. <subscribe/>
  64. <unsubscribe/>
  65. <post/>
  66. <archive/>
  67. <otherArchives/>
  68. </mailingList>
  69. </mailingLists>
  70. <prerequisites>
  71. <maven/>
  72. </prerequisites>
  73. <modules/>
  74. <scm child.scm.connection.inherit.append.path=.. child.scm.developerConnection.inherit.append.path=.. child.scm.url.inherit.append.path=.. >
  75. <connection/>
  76. <developerConnection/>
  77. <tag/>
  78. <url/>
  79. </scm>
  80. <issueManagement>
  81. <system/>
  82. <url/>
  83. </issueManagement>
  84. <ciManagement>
  85. <system/>
  86. <url/>
  87. <notifiers>
  88. <notifier>
  89. <type/>
  90. <sendOnError/>
  91. <sendOnFailure/>
  92. <sendOnSuccess/>
  93. <sendOnWarning/>
  94. <address/>
  95. <configuration>
  96. <key>value</key>
  97. </configuration>
  98. </notifier>
  99. </notifiers>
  100. </ciManagement>
  101. <distributionManagement>
  102. <repository>
  103. <uniqueVersion/>
  104. <releases>
  105. <enabled/>
  106. <updatePolicy/>
  107. <checksumPolicy/>
  108. </releases>
  109. <snapshots>
  110. <enabled/>
  111. <updatePolicy/>
  112. <checksumPolicy/>
  113. </snapshots>
  114. <id/>
  115. <name/>
  116. <url/>
  117. <layout/>
  118. </repository>
  119. <snapshotRepository>
  120. <uniqueVersion/>
  121. <releases>
  122. <enabled/>
  123. <updatePolicy/>
  124. <checksumPolicy/>
  125. </releases>
  126. <snapshots>
  127. <enabled/>
  128. <updatePolicy/>
  129. <checksumPolicy/>
  130. </snapshots>
  131. <id/>
  132. <name/>
  133. <url/>
  134. <layout/>
  135. </snapshotRepository>
  136. <site child.site.url.inherit.append.path=.. >
  137. <id/>
  138. <name/>
  139. <url/>
  140. </site>
  141. <downloadUrl/>
  142. <relocation>
  143. <groupId/>
  144. <artifactId/>
  145. <version/>
  146. <message/>
  147. </relocation>
  148. <status/>
  149. </distributionManagement>
  150. <properties>
  151. <key>value</key>
  152. </properties>
  153. <dependencyManagement>
  154. <dependencies>
  155. <dependency>
  156. <groupId/>
  157. <artifactId/>
  158. <version/>
  159. <type/>
  160. <classifier/>
  161. <scope/>
  162. <systemPath/>
  163. <exclusions>
  164. <exclusion>
  165. <groupId/>
  166. <artifactId/>
  167. </exclusion>
  168. </exclusions>
  169. <optional/>
  170. </dependency>
  171. </dependencies>
  172. </dependencyManagement>
  173. <dependencies>
  174. <dependency>
  175. <groupId/>
  176. <artifactId/>
  177. <version/>
  178. <type/>
  179. <classifier/>
  180. <scope/>
  181. <systemPath/>
  182. <exclusions>
  183. <exclusion>
  184. <groupId/>
  185. <artifactId/>
  186. </exclusion>
  187. </exclusions>
  188. <optional/>
  189. </dependency>
  190. </dependencies>
  191. <repositories>
  192. <repository>
  193. <releases>
  194. <enabled/>
  195. <updatePolicy/>
  196. <checksumPolicy/>
  197. </releases>
  198. <snapshots>
  199. <enabled/>
  200. <updatePolicy/>
  201. <checksumPolicy/>
  202. </snapshots>
  203. <id/>
  204. <name/>
  205. <url/>
  206. <layout/>
  207. </repository>
  208. </repositories>
  209. <pluginRepositories>
  210. <pluginRepository>
  211. <releases>
  212. <enabled/>
  213. <updatePolicy/>
  214. <checksumPolicy/>
  215. </releases>
  216. <snapshots>
  217. <enabled/>
  218. <updatePolicy/>
  219. <checksumPolicy/>
  220. </snapshots>
  221. <id/>
  222. <name/>
  223. <url/>
  224. <layout/>
  225. </pluginRepository>
  226. </pluginRepositories>
  227. <build>
  228. <sourceDirectory/>
  229. <scriptSourceDirectory/>
  230. <testSourceDirectory/>
  231. <outputDirectory/>
  232. <testOutputDirectory/>
  233. <extensions>
  234. <extension>
  235. <groupId/>
  236. <artifactId/>
  237. <version/>
  238. </extension>
  239. </extensions>
  240. <defaultGoal/>
  241. <resources>
  242. <resource>
  243. <targetPath/>
  244. <filtering/>
  245. <directory/>
  246. <includes/>
  247. <excludes/>
  248. </resource>
  249. </resources>
  250. <testResources>
  251. <testResource>
  252. <targetPath/>
  253. <filtering/>
  254. <directory/>
  255. <includes/>
  256. <excludes/>
  257. </testResource>
  258. </testResources>
  259. <directory/>
  260. <finalName/>
  261. <filters/>
  262. <pluginManagement>
  263. <plugins>
  264. <plugin>
  265. <groupId/>
  266. <artifactId/>
  267. <version/>
  268. <extensions/>
  269. <executions>
  270. <execution>
  271. <id/>
  272. <phase/>
  273. <goals/>
  274. <inherited/>
  275. <configuration/>
  276. </execution>
  277. </executions>
  278. <dependencies>
  279. <dependency>
  280. <groupId/>
  281. <artifactId/>
  282. <version/>
  283. <type/>
  284. <classifier/>
  285. <scope/>
  286. <systemPath/>
  287. <exclusions>
  288. <exclusion>
  289. <groupId/>
  290. <artifactId/>
  291. </exclusion>
  292. </exclusions>
  293. <optional/>
  294. </dependency>
  295. </dependencies>
  296. <goals/>
  297. <inherited/>
  298. <configuration/>
  299. </plugin>
  300. </plugins>
  301. </pluginManagement>
  302. <plugins>
  303. <plugin>
  304. <groupId/>
  305. <artifactId/>
  306. <version/>
  307. <extensions/>
  308. <executions>
  309. <execution>
  310. <id/>
  311. <phase/>
  312. <goals/>
  313. <inherited/>
  314. <configuration/>
  315. </execution>
  316. </executions>
  317. <dependencies>
  318. <dependency>
  319. <groupId/>
  320. <artifactId/>
  321. <version/>
  322. <type/>
  323. <classifier/>
  324. <scope/>
  325. <systemPath/>
  326. <exclusions>
  327. <exclusion>
  328. <groupId/>
  329. <artifactId/>
  330. </exclusion>
  331. </exclusions>
  332. <optional/>
  333. </dependency>
  334. </dependencies>
  335. <goals/>
  336. <inherited/>
  337. <configuration/>
  338. </plugin>
  339. </plugins>
  340. </build>
  341. <reports/>
  342. <reporting>
  343. <excludeDefaults/>
  344. <outputDirectory/>
  345. <plugins>
  346. <plugin>
  347. <groupId/>
  348. <artifactId/>
  349. <version/>
  350. <reportSets>
  351. <reportSet>
  352. <id/>
  353. <reports/>
  354. <inherited/>
  355. <configuration/>
  356. </reportSet>
  357. </reportSets>
  358. <inherited/>
  359. <configuration/>
  360. </plugin>
  361. </plugins>
  362. </reporting>
  363. <profiles>
  364. <profile>
  365. <id/>
  366. <activation>
  367. <activeByDefault/>
  368. <jdk/>
  369. <os>
  370. <name/>
  371. <family/>
  372. <arch/>
  373. <version/>
  374. </os>
  375. <property>
  376. <name/>
  377. <value/>
  378. </property>
  379. <file>
  380. <missing/>
  381. <exists/>
  382. </file>
  383. </activation>
  384. <build>
  385. <defaultGoal/>
  386. <resources>
  387. <resource>
  388. <targetPath/>
  389. <filtering/>
  390. <directory/>
  391. <includes/>
  392. <excludes/>
  393. </resource>
  394. </resources>
  395. <testResources>
  396. <testResource>
  397. <targetPath/>
  398. <filtering/>
  399. <directory/>
  400. <includes/>
  401. <excludes/>
  402. </testResource>
  403. </testResources>
  404. <directory/>
  405. <finalName/>
  406. <filters/>
  407. <pluginManagement>
  408. <plugins>
  409. <plugin>
  410. <groupId/>
  411. <artifactId/>
  412. <version/>
  413. <extensions/>
  414. <executions>
  415. <execution>
  416. <id/>
  417. <phase/>
  418. <goals/>
  419. <inherited/>
  420. <configuration/>
  421. </execution>
  422. </executions>
  423. <dependencies>
  424. <dependency>
  425. <groupId/>
  426. <artifactId/>
  427. <version/>
  428. <type/>
  429. <classifier/>
  430. <scope/>
  431. <systemPath/>
  432. <exclusions>
  433. <exclusion>
  434. <groupId/>
  435. <artifactId/>
  436. </exclusion>
  437. </exclusions>
  438. <optional/>
  439. </dependency>
  440. </dependencies>
  441. <goals/>
  442. <inherited/>
  443. <configuration/>
  444. </plugin>
  445. </plugins>
  446. </pluginManagement>
  447. <plugins>
  448. <plugin>
  449. <groupId/>
  450. <artifactId/>
  451. <version/>
  452. <extensions/>
  453. <executions>
  454. <execution>
  455. <id/>
  456. <phase/>
  457. <goals/>
  458. <inherited/>
  459. <configuration/>
  460. </execution>
  461. </executions>
  462. <dependencies>
  463. <dependency>
  464. <groupId/>
  465. <artifactId/>
  466. <version/>
  467. <type/>
  468. <classifier/>
  469. <scope/>
  470. <systemPath/>
  471. <exclusions>
  472. <exclusion>
  473. <groupId/>
  474. <artifactId/>
  475. </exclusion>
  476. </exclusions>
  477. <optional/>
  478. </dependency>
  479. </dependencies>
  480. <goals/>
  481. <inherited/>
  482. <configuration/>
  483. </plugin>
  484. </plugins>
  485. </build>
  486. <modules/>
  487. <distributionManagement>
  488. <repository>
  489. <uniqueVersion/>
  490. <releases>
  491. <enabled/>
  492. <updatePolicy/>
  493. <checksumPolicy/>
  494. </releases>
  495. <snapshots>
  496. <enabled/>
  497. <updatePolicy/>
  498. <checksumPolicy/>
  499. </snapshots>
  500. <id/>
  501. <name/>
  502. <url/>
  503. <layout/>
  504. </repository>
  505. <snapshotRepository>
  506. <uniqueVersion/>
  507. <releases>
  508. <enabled/>
  509. <updatePolicy/>
  510. <checksumPolicy/>
  511. </releases>
  512. <snapshots>
  513. <enabled/>
  514. <updatePolicy/>
  515. <checksumPolicy/>
  516. </snapshots>
  517. <id/>
  518. <name/>
  519. <url/>
  520. <layout/>
  521. </snapshotRepository>
  522. <site child.site.url.inherit.append.path=.. >
  523. <id/>
  524. <name/>
  525. <url/>
  526. </site>
  527. <downloadUrl/>
  528. <relocation>
  529. <groupId/>
  530. <artifactId/>
  531. <version/>
  532. <message/>
  533. </relocation>
  534. <status/>
  535. </distributionManagement>
  536. <properties>
  537. <key>value</key>
  538. </properties>
  539. <dependencyManagement>
  540. <dependencies>
  541. <dependency>
  542. <groupId/>
  543. <artifactId/>
  544. <version/>
  545. <type/>
  546. <classifier/>
  547. <scope/>
  548. <systemPath/>
  549. <exclusions>
  550. <exclusion>
  551. <groupId/>
  552. <artifactId/>
  553. </exclusion>
  554. </exclusions>
  555. <optional/>
  556. </dependency>
  557. </dependencies>
  558. </dependencyManagement>
  559. <dependencies>
  560. <dependency>
  561. <groupId/>
  562. <artifactId/>
  563. <version/>
  564. <type/>
  565. <classifier/>
  566. <scope/>
  567. <systemPath/>
  568. <exclusions>
  569. <exclusion>
  570. <groupId/>
  571. <artifactId/>
  572. </exclusion>
  573. </exclusions>
  574. <optional/>
  575. </dependency>
  576. </dependencies>
  577. <repositories>
  578. <repository>
  579. <releases>
  580. <enabled/>
  581. <updatePolicy/>
  582. <checksumPolicy/>
  583. </releases>
  584. <snapshots>
  585. <enabled/>
  586. <updatePolicy/>
  587. <checksumPolicy/>
  588. </snapshots>
  589. <id/>
  590. <name/>
  591. <url/>
  592. <layout/>
  593. </repository>
  594. </repositories>
  595. <pluginRepositories>
  596. <pluginRepository>
  597. <releases>
  598. <enabled/>
  599. <updatePolicy/>
  600. <checksumPolicy/>
  601. </releases>
  602. <snapshots>
  603. <enabled/>
  604. <updatePolicy/>
  605. <checksumPolicy/>
  606. </snapshots>
  607. <id/>
  608. <name/>
  609. <url/>
  610. <layout/>
  611. </pluginRepository>
  612. </pluginRepositories>
  613. <reports/>
  614. <reporting>
  615. <excludeDefaults/>
  616. <outputDirectory/>
  617. <plugins>
  618. <plugin>
  619. <groupId/>
  620. <artifactId/>
  621. <version/>
  622. <reportSets>
  623. <reportSet>
  624. <id/>
  625. <reports/>
  626. <inherited/>
  627. <configuration/>
  628. </reportSet>
  629. </reportSets>
  630. <inherited/>
  631. <configuration/>
  632. </plugin>
  633. </plugins>
  634. </reporting>
  635. </profile>
  636. </profiles>
  637. </project>

project

<project>元素是描述符的根。下表列出了所有可能的子元素。

AttributeTypeDescription
child.project.url.inherit.append.pathString当子级继承项目的url时,是否追加路径?注意:虽然出于技术原因,该字段的类型为String,但语义类型实际上是Boolean
Default value istrue
Since: Maven 3.6.1
ElementTypeDescription
modelVersionString指定了当前Maven模型的版本号
ParentParent父项目的位置(如果存在)。如果未指定父项目中的值,则它们将是此项目的默认值。该位置以group ID, artifact ID and version的形式给出。
groupIdString项目的通用唯一标识符。通常使用完全限定的包名称来将其与具有类似名称的其他项目(例如org.apache.maven)区分开来。
artifactIdStringgroupId给定的组中是唯一的。artifact是由项目生产或使用的东西。Maven为项目生成的工件的示例包括:JAR、源代码和二进制发行版以及WAR。
versionString此项目生成的artifact的当前版本。
packagingString该项目产生的工件的类型,例如jar war ear pom。插件可以创建自己的打包,因此也可以创建它们自己的打包类型,因此该列表不包含所有可能的类型。

Default value isjar

.
nameString项目名称
descriptionString项目的详细描述,Maven在需要描述项目时使用,例如在网站上。虽然可以将该元素指定为CDATA以允许在描述中使用HTML标记,但不建议允许纯文本表示。如果需要修改生成的网站的索引页,则可以指定自己的索引页而不是调整此文本。
urlString项目主页的URL。
默认值为:父值[+路径调整]+(artifactId或project.directory属性),或者如果项目的子级为.project.url.inherit.append.path=“false”,则仅为父值
inceptionYearString项目开始的年份,用4位数字指定。此值在生成版权声明以及作为信息时使用。
OrganizationOrganization该元素描述项目所属组织的各种属性。创建文档时使用这些属性(用于版权声明和链接)。
licenses/license*List<License>(Many) 此元素描述此项目的所有许可证。每个许可都由许可元素描述,然后由其他元素描述。项目应仅列出应用于项目的许可证,而不是应用于依赖项的许可证。如果列出了多个许可证,则假设用户可以选择其中的任何一个,而不是必须全部接受。
developers/developer*List<Developer>(Many) 描述项目的提交者。
contributors/contributor*List<Contributor>(Many) 描述尚未提交的项目参与者。
mailingLists/mailingList*List<MailingList>(Many) Contains information about a project's mailing lists.
PrerequisitesPrerequisitesDescribes the prerequisites in the build environment for this project.
modules/module*List<String>(Many) 要作为此项目的一部分生成的模块(有时称为子项目)。列出的每个模块都是包含该模块的目录的相对路径。为了与从父级计算默认url的方式一致,建议模块名称与artifact ids匹配。
ScmScmSpecification for the SCM used by the project, such as CVS, Subversion, etc.
IssueManagementIssueManagementThe project's issue management system information.
CiManagementCiManagementThe project's continuous integration information.
DistributionManagementDistributionManagement支持将站点和工件分别部署到远程web服务器和存储库的项目的分发信息。
properties/key=value*Properties(Many) 可以在整个POM中用作替代的属性,并在启用时用作资源中的筛选器。格式为<name>value</name>。
DependencyManagementDependencyManagement从该项目继承的项目的默认依赖项信息。此部分中的依赖项不会立即解析。相反,当从该POM派生的POM声明由匹配的groupId和artifactId描述的依赖项时,如果尚未指定该部分中的版本和其他值,则将其用于该依赖项。
dependencies/Dependency*List<Dependency>(Many) 

该元素描述与项目关联的所有依赖项。这些依赖项用于在构建过程中为项目构建类路径。它们将从该项目中定义的存储库中自动下载。有关详细信息,请参阅依赖关系机制。

repositories/Repository*List<Repository>(Many) The lists of the remote repositories for discovering dependencies and extensions.
pluginRepositories/pluginRepository*List<Repository>(Many) The lists of the remote repositories for discovering plugins for builds and reports.
BuildBuildInformation required to build the project.
reportsDOMDeprecated. Now ignored by Maven.
reportingReporting该元素包括用于在Maven生成的站点上生成报告的报告插件的规范。这些报告将在用户执行mvn站点时运行。所有报告都将包含在导航栏中以供浏览。
profiles/profile*List<Profile>(Many) 激活时将修改生成过程的项目本地生成配置文件的列表。
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/383368
推荐阅读
相关标签
  

闽ICP备14008679号