什么是pom?
pom作为项目对象模型。通过xml表示maven项目,使用pom.xml来实现。主要描述了项目:包括配置文件;开发者需要遵循的规则,缺陷管理系统,组织和licenses,项目的url,项目的依赖性,以及其他所有的项目相关因素。
pom.xml 配置文件
- <project>
- <parent>
- ...
- parent>
- <modelVersion>4.0.0modelVersion>
- <groupId>...groupId>
- <artifactId>...artifactId>
- <version>...version>
- <packaging>...packaging>
- <scm>
- ...
- scm>
- <dependencies>
- ...
- dependencies>
- <dependencyManagement>
- ...
- dependencyManagement>
- <modules>
- ...
- modules>
- <properties>
- ...
- properties>
- <build>
- ...
- build>
- <reporting>
- ...
- reporting>
- <name>...name>
- <description>...description>
- <url>...url>
- <inceptionYear>...inceptionYear>
- <licenses>
- licenses>
- <organization>
- organization>
- <developers>
- developers>
- <contributors>
- contributors>
- <issueManagement>
- issueManagement>
- <ciManagement>
- ciManagement>
- <mailingLists>
- mailingLists>
- <prerequisites>
- prerequisites>
- <repositories>
- repositories>
- <pluginRepositories>
- pluginRepositories>
- <distributionManagement>
- distributionManagement>
- <profiles>
- profiles>
- project>
maven 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.0http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId/>
- <groupId/>
- <version/>
- <relativePath/>
- parent>
- <modelVersion>4.0.0modelVersion>
- <groupId>asia.banseongroupId>
- <artifactId>banseon-maven2artifactId>
- <packaging>jarpackaging>
- <version>1.0-SNAPSHOTversion>
- <name>banseon-mavenname>
- <url>http://www.baidu.com/banseonurl>
- <description>A maven project to study maven.description>
- <prerequisites>
- <maven/>
- prerequisites>
- <issueManagement>
- <system>jirasystem>
- <url>http://jira.baidu.com/banseonurl>
- issueManagement>
- <ciManagement>
- <system/>
- <url/>
- <notifiers>
- <notifier>
- <type/>
- <sendOnError/>
- <sendOnFailure/>
- <sendOnSuccess/>
- <sendOnWarning/>
- <address/>
- <configuration/>
- notifier>
- notifiers>
- ciManagement>
- <inceptionYear/>
- <mailingLists>
- <mailingList>
- <name>Demoname>
- <post>[email protected]post>
- <subscribe>[email protected]subscribe>
- <unsubscribe>[email protected]unsubscribe>
- <archive>http:/hi.baidu.com/banseon/demo/dev/archive>
- mailingList>
- mailingLists>
- <developers>
- <developer>
- <id>HELLO WORLDid>
- <name>banseonname>
- <email>[email protected]email>
- <url/>
- <roles>
- <role>Project Managerrole>
- <role>Architectrole>
- roles>
- <organization>demoorganization>
- <organizationUrl>http://hi.baidu.com/banseonorganizationUrl>
- <properties>
- <dept>Nodept>
- properties>
- <timezone>-5timezone>
- developer>
- developers>
- <contributors>
- <contributor>
- <name/><email/><url/><organization/><organizationUrl/><roles/><timezone/><properties/>
- contributor>
- contributors>
- <licenses>
- <license>
- <name>Apache 2name>
- <url>http://www.baidu.com/banseon/LICENSE-2.0.txturl>
- <comments>A business-friendly OSS licensecomments>
- license>
- licenses>
- <scm>
- <connection>
- scm:svn:http://svn.baidu.com/banseon/maven/banseon/banseon-maven2-trunk(dao-trunk)
- connection>
- <developerConnection>
- scm:svn:http://svn.baidu.com/banseon/maven/banseon/dao-trunk
- developerConnection>
- <tag/>
- <url>http://svn.baidu.com/banseonurl>
- scm>
- <organization>
- <name>demoname>
- <url>http://www.baidu.com/banseonurl>
- organization>
- <build>
- <sourceDirectory/>
- <scriptSourceDirectory/>
- <testSourceDirectory/>
- <outputDirectory/>
- <testOutputDirectory/>
- <extensions>
- <extension>
- <groupId/>
- <artifactId/>
- <version/>
- extension>
- extensions>
- <defaultGoal/>
- <resources>
- <resource>
- <targetPath/>
- <filtering/>
- <directory/>
- <includes/>
- <excludes/>
- resource>
- resources>
- <testResources>
- <testResource>
- <targetPath/><filtering/><directory/><includes/><excludes/>
- testResource>
- testResources>
- <directory/>
- <finalName/>
- <filters/>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId/>
- <artifactId/>
- <version/>
- <extensions/>
- <executions>
- <execution>
- <id/>
- <phase/>
- <goals/>
- <inherited/>
- <configuration/>
- execution>
- executions>
- <dependencies>
- <dependency>
- ......
- dependency>
- dependencies>
- <inherited/>
- <configuration/>
- plugin>
- plugins>
- pluginManagement>
- <plugins>
- <plugin>
- <groupId/><artifactId/><version/><extensions/>
- <executions>
- <execution>
- <id/><phase/><goals/><inherited/><configuration/>
- execution>
- executions>
- <dependencies>
- <dependency>
- ......
- dependency>
- dependencies>
- <goals/><inherited/><configuration/>
- plugin>
- plugins>
- build>
- <profiles>
- <profile>
- <id/>
- <activeByDefault/>
- <jdk/>
- <os>
- <name>Windows XPname>
- <family>Windowsfamily>
- <arch>x86arch>
- <version>5.1.2600version>
- os>
- <name>mavenVersionname>
- <value>2.0.3value>
- property>
- <exists>/usr/local/hudson/hudson-home/jobs/maven-guide-zh-to-production/workspace/exists>
- <missing>/usr/local/hudson/hudson-home/jobs/maven-guide-zh-to-production/workspace/missing>
- file>
- activation>
- <build>
- <defaultGoal/>
- <resources>
- <resource>
- <targetPath/><filtering/><directory/><includes/><excludes/>
- resource>
- resources>
- <testResources>
- <testResource>
- <targetPath/><filtering/><directory/><includes/><excludes/>
- testResource>
- testResources>
- <directory/><finalName/><filters/>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId/><artifactId/><version/><extensions/>
- <executions>
- <execution>
- <id/><phase/><goals/><inherited/><configuration/>
- execution>
- executions>
- <dependencies>
- <dependency>
- ......
- dependency>
- dependencies>
- <goals/><inherited/><configuration/>
- plugin>
- plugins>
- pluginManagement>
- <plugins>
- <plugin>
- <groupId/><artifactId/><version/><extensions/>
- <executions>
- <execution>
- <id/><phase/><goals/><inherited/><configuration/>
- execution>
- executions>
- <dependencies>
- <dependency>
- ......
- dependency>
- dependencies>
- <goals/><inherited/><configuration/>
- plugin>
- plugins>
- build>
- <modules/>
- <repositories>
- <repository>
- <releases>
- <enabled/><updatePolicy/><checksumPolicy/>
- releases>
- <snapshots>
- <enabled/><updatePolicy/><checksumPolicy/>
- snapshots>
- <id/><name/><url/><layout/>
- repository>
- repositories>
- <pluginRepositories>
- <pluginRepository>
- <releases>
- <enabled/><updatePolicy/><checksumPolicy/>
- releases>
- <snapshots>
- <enabled/><updatePolicy/><checksumPolicy/>
- snapshots>
- <id/><name/><url/><layout/>
- pluginRepository>
- pluginRepositories>
- <dependencies>
- <dependency>
- ......
- dependency>
- dependencies>
- <reports/>
- <reporting>
- ......
- reporting>
- <dependencyManagement>
- <dependencies>
- <dependency>
- ......
- dependency>
- dependencies>
- dependencyManagement>
- <distributionManagement>
- ......
- distributionManagement>
- <properties/>
- profile>
- profiles>
- <modules/>
- <repositories>
- <repository>
- <releases>
- <enabled/>
- <updatePolicy/>
- <checksumPolicy/>
- releases>
- <snapshots>
- <enabled/><updatePolicy/><checksumPolicy/>
- snapshots>
- <id>banseon-repository-proxyid>
- <name>banseon-repository-proxyname>
- <url>http://192.168.1.169:9999/repository/url>
- <layout>defaultlayout>
- repository>
- repositories>
- <pluginRepositories>
- <pluginRepository>
- ......
- pluginRepository>
- pluginRepositories>
- <dependencies>
- <dependency>
- <groupId>org.apache.mavengroupId>
- <artifactId>maven-artifactartifactId>
- <version>3.8.1version>
- <type>jartype>
- <classifier>classifier>
- <systemPath>systemPath>
- <exclusions>
- <exclusion>
- <artifactId>spring-coreartifactId>
- <groupId>org.springframeworkgroupId>
- exclusion>
- exclusions>
- <optional>trueoptional>
- dependency>
- dependencies>
- <reports>reports>
- <reporting>
- <excludeDefaults/>
- <outputDirectory/>
- <plugins>
- <plugin>
- <groupId/>
- <artifactId/>
- <version/>
- <inherited/>
- <configuration/>
- <reportSets>
- <reportSet>
- <id/>
- <configuration/>
- <inherited/>
- <reports/>
- reportSet>
- reportSets>
- plugin>
- plugins>
- reporting>
- <dependencyManagement>
- <dependencies>
- <dependency>
- ......
- dependency>
- dependencies>
- dependencyManagement>
- <distributionManagement>
- <repository>
- <uniqueVersion/>
- <id>banseon-maven2id>
- <name>banseon maven2name>
- <url>file://${basedir}/target/deployurl>
- <layout/>
- repository>
- <snapshotRepository>
- <uniqueVersion/>
- <id>banseon-maven2id>
- <name>Banseon-maven2 Snapshot Repositoryname>
- <url>scp://svn.baidu.com/banseon:/usr/local/maven-snapshoturl>
- <layout/>
- snapshotRepository>
- <site>
- <id>banseon-siteid>
- <name>business api websitename>
- <url>
- scp://svn.baidu.com/banseon:/var/www/localhost/banseon-web
- url>
- site>
- <downloadUrl/>
- <relocation>
- <groupId/>
- <artifactId/>
- <version/>
- <message/>
- relocation>
- <status/>
- distributionManagement>
- <properties/>
- project>