zoukankan      html  css  js  c++  java
  • maven pom文件标签含义

    1、dependency里面的scope

    dependency里面的classifier

    dependency里面的type

    dependency里面的systemPath

    dependency里面的optional:

    dependency里面的exclusions:

    2、dependency里面的version

    maven的pom.xml有些依赖为什么可以不写版本号。因为他的 <parent> 父级依赖已经定义了版本,子项目自己的groupId和version可以从父项目继承。

    3、repositories 和 pluginRepository

    pom.xml中repositories标签的作用是: 用来配置maven项目的远程仓库。示例如下:
        <repositories>
            <repository>
                <id>nexus</id>
                <name>Nexus Repository</name>
                <url>远程仓库地址</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>  <!--snapshots默认是关闭的,需要开启  -->
                </snapshots>
            </repository>
        </repositories>

    按照上面配置是实现了配置maven项目的远程仓库,但是,这样的配置,如果我们创建一个项目,就需要配置一次,很麻烦。可以将上面的远程仓库配置在maven的setting.xml里面.这样就可以实现只配置一次
     

    pom.xml中pluginRepository标签的作用是: 用来配置maven插件的远程仓库。示例如下:
        <pluginRepositories>
            <pluginRepository>
                <id>nexus</id>
                <name>Team Nexus Repository</name>
                <url>远程仓库地址</url>
            </pluginRepository>
        </pluginRepositories>

    4、import

      import只在dependencyManagement元素下才有效果,作用是将目标POM中的dependencyManagement配置导入并合并到当前POM的dependencyManagement元素中,如下就是讲account-aggregator中的dependencyManagement配置导入并合并到当前POM中。

    <dependencyManagement>
          <dependencies>
            <dependency>
                <groupId>com.youzhibing.account</groupId>
                  <artifactId>account-aggregator</artifactId>
                  <version>1.0.0-SNAPSHOT</version>
                <type>pom</type>
                  <scope>import</scope>
            </dependency>
          </dependencies>
      </dependencyManagement>
  • 相关阅读:
    PAT 1006 Sign In and Sign Out
    PAT 1004. Counting Leaves
    JavaEE开发环境安装
    NoSql数据库探讨
    maven的配置
    VMWARE 下使用 32位 Ubuntu Linux ,不能给它分配超过3.5G 内存?
    XCODE 4.3 WITH NO GCC?
    在苹果虚拟机上跑 ROR —— Ruby on Rails On Vmware OSX 10.7.3
    推荐一首让人疯狂的好歌《Pumped Up Kicks》。好吧,顺便测下博客园可以写点无关技术的帖子吗?
    RUBY元编程学习之”编写你的第一种领域专属语言“
  • 原文地址:https://www.cnblogs.com/cuiqq/p/11023184.html
Copyright © 2011-2022 走看看