maven的pom.xml的讲解

7 篇文章 0 订阅
<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">
  <!-- pom的版本号 -->
  <modelVersion>4.0.0</modelVersion>
  <!--反写公司网址 + 项目名  -->
  <groupId>com.misssad.HelloMiss</groupId>
  <!-- 项目名 + 模块名 -->
  <artifactId>Hi</artifactId>
  <!-- 
  第一个 0 大版本号
  第二个 0 表示分支版本号
  第三个0表示小版本号

  snapshot 快照
  alpha 内部测试
  beta 公测
  Release 稳定
  GA正式发布
   -->
  <version>0.0.1-SNAPSHOT</version>
  <!-- 默认是jar 
  war -->
  <packaging>jar</packaging>
  <!-- 项目名 -->
  <name>Hi</name>
  <!-- 项目网址 -->
  <url>http://maven.apache.org</url>

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

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <!-- 依赖作用域:只对测试代码有效,对主代码无效 -->
      <scope>test</scope>
      <!-- 排除依赖传递列表 -->
      <exclusions>  
        <exclusion></exclusion>
      </exclusions>
    </dependency>
  </dependencies>
  <!--依赖管理 一般用于父模块中
  比如吧Junit放到父模块中,让子模块去继承  -->
  <dependencyManagement>
    <dependencies>
        <dependency></dependency>
    </dependencies>
  </dependencyManagement>
  <!--一般是对构建行为进行处理,用的比较多的就是plugins标签
  比如下面就使用到了maven的source插件,使其在打包时,
  将源码也进行打包-->
  <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.0.1</version>
            <!-- 在什么时候执行上面的插件 -->
            <executions>
                <execution>
                    <id>attach-sources</id>
                    <!-- 在打包的时候,执行 -->
                    <phase>package</phase>
                    <!-- 执行的目标是打成jar -->
                    <goals>
                        <goal>jar-no-fork</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
  </build>
  <!-- 用于子模块中说明继承哪个父模块 -->
  <parent>
    <groupId>1</groupId>
    <artifactId>1</artifactId>
    <version>1</version>
  </parent>
  <!-- 可以同时编译多个模块 -->
  <modules>
    <module></module>
  </modules>
</project>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

山鬼谣me

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值