笔记:Maven 项目基本配置

Maven 的基本设置包含项目基本信息和项目信息,基本信息主要用于设置当前包的归属项目、当前项目等,配置文件结构如下:

<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

http://maven.apache.org/xsd/maven-4.0.0.xsd">

        <modelVersion>4.0.0</modelVersion>

          

        <!-- 基本设置 -->

        <groupId>项目归属组</groupId>

        <artifactId>项目唯一ID</artifactId>

        <version>版本号</version>

        <packaging>定义打包方式(默认值:jar)</packaging>

        <dependencies>依赖项(具体说明)</dependencies>

        <parent>父项目(具体说明)</parent>

        <dependencyManagement>...</dependencyManagement>

        <modules>...</modules>

<!-- 设置变量 -->

        <properties>

<!-- 使用变量时,格式为:${变量名} -->

<变量名>变量值</变量名>

</properties>

        <!-- 项目信息设置 -->

        <name>项目名称</name>

        <description>项目描述性文字</description>

        <url>项目的URL地址</url>

        <inceptionYear>项目初始时间</inceptionYear>

        <licenses><!-- 许可协议 -->

     <name>Apache 2</name>

        <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>

        <distribution>repo</distribution>

        <comments>A business-friendly OSS license</comments>

        </licenses>

        <organization><!-- 组织 -->

        <name>Codehaus Mojo</name>

        <url>http://mojo.codehaus.org</url>

        </organization>

        <developers><!-- 项目开发人员和角色,一个或者多个 -->

        <developer>

            <id>eric</id>

            <name>Eric</name>

            <email>eredmond@codehaus.org</email>

            <url>http://eric.propellors.net</url>

            <organization>Codehaus</organization>

            <organizationUrl>http://mojo.codehaus.org</organizationUrl>

            <roles><!-- 角色 -->

               <role>architect</role>

               <role>developer</role>

            </roles>

            <timezone>-6</timezone><!-- 时区 -->

            <properties>

               <picUrl>http://tinyurl.com/prv4t</picUrl>

            </properties>

        </developer>

        </developers>

        <contributors>

   

posted @ 2017-02-19 16:44  立3807  阅读(170)  评论(0编辑  收藏  举报