config中指它setting.xml配置nexus的服务
maven配置文
<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文件
<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仓库下载地址