maven标签解析

来源:互联网 发布:minitool数据恢复工具 编辑:程序博客网 时间:2024/06/01 08:52

看了慕课网的老师讲解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>com.hi</groupId><!-- 反写公司网址+项目名 -->
  <artifactId>hi</artifactId><!-- 项目名+模块名 -->
  <!-- 0 --大版本号0 -- 分支版本号1 -- 小版本号
      snapshot 快照
      alpha 内部测试
      beta 公测
      release 稳定
      GA 正式发布 -->
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging><!-- 默认是jar,zip war pom也可以 -->
  <name>hi</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>4.0</version>
      <scope>test</scope><!-- 依赖范围 -->

     <!--

<type>apk</type>告诉maven使用maven android plugin来进行处理<type>为apk的依赖。从而推想<type>ejb</type>就是告诉maven使用maven ejb plugin来处理

-->

      <type></type>
      <optional></optional><!-- 依赖是否可选,默认: false 子项目集成,true子项目必须显式的依赖-->
      <exclusions><!-- 排除依赖传递 -->
        <exclusion>
            <!-- eg:我们只需要spring的某个jar,但是spring依赖其他jar,本项目排除其他jar,只需要核心jar -->
        </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>2.4</version><!-- 版本 -->
                  <executions>
                      <execution>
                          <phase>package</phase><!-- 执行在什么生命周期里,这里是说在package的时候执行源码打包的插件 -->
                          <goals>
                              <goal>jar-no-fork</goal><!-- 一种形式,有4-5中,官网查,一般用这个,不分支的打包资源 -->
                          </goals>
                      </execution>
                  </executions>
              </plugin>
          </plugins>
      </build>
 
      <parent><!-- 继承 -->
          
      </parent>
      
      <modules><!-- 指定多个模块一起编译 -->
          <module></module>
      </modules>
</project>


0 0
原创粉丝点击