Maven中pom.xml标签含义大全

POM:全称 Project Object Model(项目对象模型)

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <!-- 指定了当前pom.xml的版本 -->
    <modelVersion>4.0.0</modelVersion>
    <!-- 主项目的标识属于哪个项目   (公司网址+项目名) -->
    <groupId>com.ouyang.maven</groupId>
    <!--模块标识,实际项目的模块(项目名+模块名)-->
    <artifactId>maven-test</artifactId>
    <!--
    第一个0大版本号,第二个0表示分支版本号,第三个0表示小版本号
    SNAPSHOT:快照
    ALPHA:内部测试
    BETA:公测
    RELEASE:稳定
    GA:正式发布
    -->
    <version>0.0.1-SNAPSHOT</version>
    <!-- 默认是jar   war zip pom -->
    <packaging>jar</packaging>
    <!-- 项目的描述名 -->
    <name>maven-test</name>
    <!-- 项目的地址 -->
    <url>http://maven.apache.org</url>
    <!-- 项目描述 -->
    <description></description>
    <!-- 开发人员 -->
    <developers></developers>
    <!-- 许可证 -->
    <licenses></licenses>
    <!-- 组织信息 -->
    <organization></organization>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <!--
            依赖范围
            compile:默认的范围,编译测试运行都有效
            provided:在编译测试时有效
            runtime:测试和运行时有效
            test:测试时有效
            system:在编译测试时有效(需要与本地系统做关联)
            import:导入的范围,只做用dependcyManagement中,表示从其他的pom中导入dependecy的配置
            -->
            <scope>test</scope>
            <!-- 依赖是否可选 -->
            <!-- <optional>false</optional> -->
            <!-- 排除依赖传递列表 -->
            <exclusions>
                <!-- <exclusion>
              <groupId></groupId>
              <artifactId></artifactId>
            </exclusion> -->
            </exclusions>
        </dependency>
    </dependencies>
    <!-- 依赖管理(可以提供父依赖)-->
    <dependencyManagement>
        <!-- <dependencies>
           <dependency></dependency>
       </dependencies> -->
    </dependencyManagement>

    <build>
        <!-- 插件列表 -->
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <!-- 在子模块中对父模块pom的继承 -->
    <!-- <parent></parent> -->
    <!-- 聚合多个运行的maven项-->
    <!-- <modules></modules> -->
</project>

 


版权声明:本文为weixin_40461030原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。