前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >maven中pom.xml标签作用 原

maven中pom.xml标签作用 原

作者头像
用户2603479
发布2018-08-15 16:57:47
4400
发布2018-08-15 16:57:47
举报
文章被收录于专栏:JAVA技术站JAVA技术站

config中指它setting.xml配置nexus的服务

maven配置文

代码语言:javascript
复制
<servers>
    <!-- server
     | Specifies the authentication information to use when connecting to a particular server, identified by
     | a unique name within the system (referred to by the 'id' attribute below).
     |
     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
     |       used together.
     | -->
    <server>
      <id>thirdparty</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
    

    <!-- Another sample, using keys to authenticate.
    <server>
      <id>siteServer</id>
      <privateKey>/path/to/private/key</privateKey>
      <passphrase>optional; leave empty if not used.</passphrase>
    </server>
    -->
  </servers>

件pom.xml中有很多标签,如下一个基本的pom.xml文件

代码语言:javascript
复制
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <packaging>jar</packaging>
  <version>0.0.1</version>
  <name>my-app</name>
  <url>http://www.nmtx.com</url>
   <repositories>
    <repository>
	   <id>codehausSnapshots</id>
      <name>Codehaus Snapshots</name>
      <url>http://tst-nexus.nmtx.me/nexus/content/groups/public/</url>
	</repository>
  </repositories>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
	<dependency>
    <groupId>com.jfinal</groupId>
    <artifactId>jfinal</artifactId>
    <version>1.5</version>
</dependency>
  </dependencies>
  <build>
   <filters>
      <filter>src/main/filters/filter.properties</filter>
    </filters>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
	 <finalName>my-webapp</finalName>
  </build>
  <properties>
    <filter.name>hello1</filter.name>
  </properties>
  <distributionManagement>
    <repository>
      <id>thirdparty</id>
      <name>my-app</name>
      <url>http://tst-nexus.nmtx.me/nexus/content/repositories/thirdparty </url>
    </repository>
  </distributionManagement>
</project>

project工程标识

modelVersion文档版本型,xmlns指定了文档描述类型

groupId 工程的分组名,通常是公司域名的倒序

artifactId工程名

packaging 打包的类型,有jar,war等

name 工程的描述性文件,工程名称,在site文档中体现

url 工程的描述性文件,通常是指工程访问的根路径,在site文档中有体现

dependencies 依赖包根目录

finalName 工程打包后的工程名,默认工程名为artifactId名称

dependency包依赖识

filters 过滤标签

filter 过滤文件,属性格式采用key value如filter.name=hello 取值 ${filter.name}

resources 指定要过滤的文件

directory过滤的文件路径

filtering是否过滤,默认为false

properties 自定义属性值 取值为${filter.name}

distributionManagement把包发布到远程仓库中,根元表中的id和setting.xml对应用server要一致否则会报401错误

repositorys指定maven仓库下载地址

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2017/03/08 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档