IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> JavaScript知识库 -> 深入浅出pom.xml文件 -> 正文阅读

[JavaScript知识库]深入浅出pom.xml文件

前言

在每一个pom文件的开头都会有这样几行代码

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">

这里面有几个http的连接,我们依次点开看看。

http://maven.apache.org/POM/4.0.0

在这里插入图片描述

http://www.w3.org/2001/XMLSchema-instance

在这里插入图片描述
https://maven.apache.org/POM/4.0.0%20https://maven.apache.org/xsd/maven-4.0.0.xsd

在这里插入图片描述

https://maven.apache.org/xsd/maven-4.0.0.xsd
在这里插入图片描述

最后这篇里面的内容和我们代码中点进去的内容一致。

在这里插入图片描述
下面我们来分析一下其中的标签。

xs:element

project

  <xs:element name="project" type="Model">
    <xs:annotation>
      <xs:documentation source="version">3.0.0+</xs:documentation>
      <xs:documentation source="description">
         The &lt;code&gt;&amp;lt;project&amp;gt;&lt;/code&gt; element is the root of the descriptor.
         The following table lists all of the possible child elements.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

相当于1级标签,xs:complexType是element的二级标签,所有的complexType需要在element下。

一个xml文件只能有一个root标签。例如我们尝试在xml中添加一个project标签。

在这里插入图片描述

xs:complexType

http://www.w3.org/TR/xmlschema-1/#element-complexType

复杂类型标签。xs:all中定义了可以使用的子标签。

Model

Contributor

Profile

Activation

ActivationFile

ActivationProperty

ActivationOS

DependencyManagement *

  <xs:complexType name="DependencyManagement">
    <xs:annotation>
      <xs:documentation source="version">4.0.0</xs:documentation>
      <xs:documentation source="description">
        Section for management of default dependency information for use in a group of POMs.
      </xs:documentation>
    </xs:annotation>
    <xs:all>
      <xs:element name="dependencies" minOccurs="0">
        <xs:annotation>
          <xs:documentation source="version">4.0.0</xs:documentation>
          <xs:documentation source="description">
            The dependencies specified here are not used until they
            are referenced in a POM within the group. This allows the
            specification of a &quot;standard&quot; version for a particular
            dependency.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="dependency" minOccurs="0" maxOccurs="unbounded" type="Dependency"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:all>
  </xs:complexType>

这里是常见的三级结构,常见的用法如下

    <dependencyManagement>
        <dependencies>
            <!-- spring cloud 依赖 -->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- spring cloud alibaba 依赖 -->
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>${spring-cloud-alibaba.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- Import dependency management from Spring Boot -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

Dependency **

project 中的dependencies标签,可以在

      <xs:element name="dependencies" minOccurs="0">
        <xs:annotation>
          <xs:documentation source="version">3.0.0+</xs:documentation>
          <xs:documentation source="description">
              This element describes all of the dependencies associated with a
              project.
              These dependencies are used to construct a classpath for your
              project during the build process. They are automatically downloaded from the
              repositories defined in this project.
              See &lt;a href=&quot;http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html&quot;&gt;the
              dependency mechanism&lt;/a&gt; for more information.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="dependency" minOccurs="0" maxOccurs="unbounded" type="Dependency"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>

https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

常见的子标签看我框起来的内容。
在这里插入图片描述
最常见的用法

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

子标签 scope,可以指定生命周期,具体官方文档参考下面的连接

https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

Exclusion

Reporting

ReportPlugin

ReportSet

BuildBase

Plugin

PluginExecution

PluginManagement

Resource

DistributionManagement

Site

Relocation

DeploymentRepository

Repository

RepositoryPolicy

MailingList

Build *

project 标签可以使用 build 标签指定(构建项目所需的信息)。

      <xs:element name="build" minOccurs="0" type="Build">
        <xs:annotation>
          <xs:documentation source="version">3.0.0+</xs:documentation>
          <xs:documentation source="description">Information required to build the project.</xs:documentation>
        </xs:annotation>
      </xs:element>

Build 标签可以包含的子标签。

在这里插入图片描述

常见用法

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring-boot.version}</version>
            </plugin>
        </plugins>
    </build>

Extension

IssueManagement

Parent

Prerequisites

CiManagement

Notifier

License

Developer

Scm

Organization

  JavaScript知识库 最新文章
ES6的相关知识点
react 函数式组件 & react其他一些总结
Vue基础超详细
前端JS也可以连点成线(Vue中运用 AntVG6)
Vue事件处理的基本使用
Vue后台项目的记录 (一)
前后端分离vue跨域,devServer配置proxy代理
TypeScript
初识vuex
vue项目安装包指令收集
上一篇文章      下一篇文章      查看所有文章
加:2022-12-25 10:59:18  更:2022-12-25 11:02:37 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年4日历 -2024/4/24 22:57:24-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码