: Notebook: This article is filed under “blog”
Introduction to the
What is poM?
POM stands for Project Object Model.
Pom.xml is maven’s configuration file that describes various information about a project.
Pom configuration overview
<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">
<modelVersion>4.0.0</modelVersion>
<! -- The Basics -->
<groupId>.</groupId>
<artifactId>.</artifactId>
<version>.</version>
<packaging>.</packaging>
<dependencies>.</dependencies>
<parent>.</parent>
<dependencyManagement>.</dependencyManagement>
<modules>.</modules>
<properties>.</properties>
<! -- Build Settings -->
<build>.</build>
<reporting>.</reporting>
<! -- More Project Information -->
<name>.</name>
<description>.</description>
<url>.</url>
<inceptionYear>.</inceptionYear>
<licenses>.</licenses>
<organization>.</organization>
<developers>.</developers>
<contributors>.</contributors>
<! -- Environment Settings -->
<issueManagement>.</issueManagement>
<ciManagement>.</ciManagement>
<mailingLists>.</mailingLists>
<scm>.</scm>
<prerequisites>.</prerequisites>
<repositories>.</repositories>
<pluginRepositories>.</pluginRepositories>
<distributionManagement>.</distributionManagement>
<profiles>.</profiles>
</project>
Copy the code
The basic configuration
- project –
project
Is the root of the descriptor in pom.xml. - modelVersion –
modelVersion
Specifies which version of the descriptor pom.xml conforms to. Maven 2 and 3 are only 4.0.0.
General jars were identified as: groupId: artifactId: the form of the version.
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.codehaus.mojo</groupId>
<artifactId>my-project</artifactId>
<version>1.0</version>
<packaging>war</packaging>
</project>
Copy the code
Maven coordinates
In Maven, according togroupId
,artifactId
,version
Combined intogroupId:artifactId:version
To uniquely identify a JAR package.
- GroupId – Identifier of a group or organization. The convention for community identification is that it begins with the reverse Domain name of the organization that created the project. Generally corresponds to the Java package structure.
- ArtifactId – Unique identifier for individual projects. Like our Tomcat, Commons, etc. Do not include periods (.) in artifactId .
- version– A specific version of a project.
- Maven has its own version specification, which generally defines major version, minor version, and Incremental version-Qualifier, such as 1.2.3-beta-01. Maven uses alphanumerical comparisons for major, minor, and Incremental, and string comparisons for Qualifier, so be careful with alpha-2 and alpha-15. Alpha-02 format is preferred.
- Maven can use special strings SNAPSHOT, LATEST, and RELEASE during version management. Such as
1.0 the SNAPSHOT
. The meanings and processing logic of each part are described as follows:- SNAPSHOT – This version is generally used during development and represents an unstable version.
- LATEST – The LATEST release of a particular artifact, either a release or a Snapshot release, depending on which was last.
- RELEASE: Indicates the last RELEASE.
- Packaging – The type of project that describes the output of a packaged project. The default value is JAR. Common output types are: POM, JAR, Maven-plugin, EJB, WAR, EAR, RAR, PAR.
Depend on the configuration
dependencies
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-embedder</artifactId>
<version>2.0</version>
<type>jar</type>
<scope>test</scope>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
</exclusion>
</exclusions>
</dependency>.</dependencies>.</project>
Copy the code
- groupId.artifactId.version– and in basic configuration
groupId
,artifactId
,version
The meaning is the same. - type– the corresponding
packaging
If not usedtype
Maven defaults to JAR. - scope– This element refers to the task’s classpath (compile and run time, test, etc.) and how to limit transitivity of dependencies. There are five qualified ranges available:
- compile– If no value is specified
scope
Maven defaults to this range. Compile dependencies are available in all classpath. In addition, these dependencies are propagated to the dependency project. - Provided – Similar to compile, but indicates that you want the JDK or container to provide it at run time. It only works on compile and test classpath and is not passable.
- Runtime – This range indicates that compilation does not require dependencies, but is used for execution. It is run time and tests the classpath, but does not compile the classpath.
- Test – This scope indicates that normal use applications do not require dependencies and is only applicable to test compilation and execution phases. It’s not transitive.
- System – This scope is similar to provided, except that you must provide a JAR that explicitly contains it. The artifact is always available and is not looked up in the repository.
- compile– If no value is specified
- systemPath– Used only when the dependency scope is system. Otherwise, if this element is set, the build will fail. The path must be an absolute path, so you are advised to use it
propertie
To specify a specific path, such as ${java.home} / lib. Because it is assumed that system-wide dependencies were previously installed, Maven will not check for the project’s repository, but for the existence of library files. If not, Maven will fail and you are advised to download and install it manually. - optional –
optional
Let other projects know that you do not need this dependency to function properly when you use this project. - exclusions– Contains one or more exclusion elements, each containing a dependency to be excluded
groupId
和artifactId
. Unlike options, which may or may not be installed and used, exclude actively removing yourself from the dependency tree.
parent
Maven supports inheritance. A child POM can use parent to specify the parent POM and then inherit its configuration.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.codehaus.mojo</groupId>
<artifactId>my-parent</artifactId>
<version>2.0</version>
<relativePath>../my-parent</relativePath>
</parent>
<artifactId>my-project</artifactId>
</project>
Copy the code
- relativePathAttention –
relativePath
Elements. It is not required before searching local and remote repositories, but can be used as an indicator for Maven to first search the path given the project’s parent.
dependencyManagement
DependencyManagement is a declaration indicating a dependency on the JAR package. Maven will not load this dependency. The dependencyManagement declaration can be inherited by the POM.
A use case of dependencyManagement is when there is a parent project. The parent project can use dependencyManagement to declare the dependency JAR packages needed in the child project. Then, when one or more of the child projects need to load the dependency, Add groupId and artifactId to the dependencies node of the subproject.
DependencyManagement is mainly used to manage the versions of dependencies to ensure that all subprojects use the same version.
modules
List of submodules.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.codehaus.mojo</groupId>
<artifactId>my-parent</artifactId>
<version>2.0</version>
<packaging>pom</packaging>
<modules>
<module>my-project</module>
<module>another-project</module>
<module>third-project/pom-example.xml</module>
</modules>
</project>
Copy the code
properties
Property list. The attributes defined can be used anywhere in the POM.xml file. The value is ${propertie}.
<project>.<properties>
<maven.compiler.source>1.7<maven.compiler.source>
<maven.compiler.target>1.7<maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>.</project>
Copy the code
Build configuration
build
Build can be divided into “project build” and “profile build”.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<! -- "Project Build" contains more elements than just the BaseBuild set -->
<build>.</build>
<profiles>
<profile>
<! -- "Profile Build" contains a subset of "Project Build"s elements -->
<build>.</build>
</profile>
</profiles>
</project>
Copy the code
Basic build configuration:
<build>
<defaultGoal>install</defaultGoal>
<directory>${basedir}/target</directory>
<finalName>${artifactId}-${version}</finalName>
<filters>
<filter>filters/filter1.properties</filter>
</filters>.</build>
Copy the code
DefaultGoal: The default execution goal or phase. If a target is given, it should be defined as it is on the command line (e.g. Jar: jar). The same is true if a phase is defined (such as installation).
Directory: Output path at build time. The default is ${basedir}/target.
FinalName: This is the final build name of the project (excluding the file extension, for example: my-project-1.0.jar)
Filter: Defines a *.properties file that contains a list of properties applicable to the resource that receives its Settings (described below). In other words, the “name = value” pair defined in the filter file replaces the ${name} string in the code.
resources
Resource configuration. Resource files are usually not code that does not need to be compiled, but rather content that needs to be bundled in a project.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<build>.<resources>
<resource>
<targetPath>META-INF/plexus</targetPath>
<filtering>false</filtering>
<directory>${basedir}/src/main/plexus</directory>
<includes>
<include>configuration.xml</include>
</includes>
<excludes>
<exclude>**/*.properties</exclude>
</excludes>
</resource>
</resources>
<testResources>.</testResources>.</build>
</project>
Copy the code
- Resources: A list of resource elements, each of which describes the files associated with the project and where to include them.
- TargetPath: Specifies the directory structure to place the resource set from the build. The default destination path is the basic directory. The typically specified target path for a resource to be wrapped in a JAR is meta-INF.
- filtering: The value is true or false. Indicates whether to enable filtering for this resource. Note that the filter
* .properties
Files do not have to be defined for filtering – resources can also use properties defined by default in POM (for example, ${project.version}) and pass them to the -d flag on the command line (for example, “-dname = value”) or explicitly defined by the properties element. Filter files over the top. - directoryThe: value defines the path of the resource. The default directory to build is
${basedir}/src/main/resources
. - Includes: a set of file matching patterns, specifying the files to be included in the directory, using * as the wildcard.
- excludesAnd:
includes
Similarly, to specify files to exclude from a directory, use * as the wildcard. Note: Ifinclude
和exclude
In the event of a conflict, Maven willexclude
As a valid term. - testResources:
testResources
与resources
The function is similar, the difference is only:testResources
The specified resource is used only for the test phase, and its default resource directory is:${basedir}/src/test/resources
。
plugins
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<build>.<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<extensions>false</extensions>
<inherited>true</inherited>
<configuration>
<classifier>test</classifier>
</configuration>
<dependencies>.</dependencies>
<executions>.</executions>
</plugin>
</plugins>
</build>
</project>
Copy the code
-
GroupId, artifactId, version: this parameter has the same meaning as groupId, artifactId, and version in the basic configuration.
-
Extensions: The value is true or false. Whether to load the extension of this plug-in. The default is false.
-
Inherited: The value is true or false. Whether this plug-in configuration should apply to POM inherited from this plug-in. The default value is true.
-
Configuration – This is the configuration for personal plugins, which is explained here.
-
Dependencies: Here dependencies are the dependencies required by the plug-in itself.
-
Executions: Remember that a plug-in can have multiple targets. There might be a separate configuration for each target, and there might even be a complete binding of the plug-in’s target to different phases. Performs the execution of the target that configures the plug-in.
- Id: Identifies the execution target.
- Goals: Like all pluralistic POM elements, it contains a list of individual elements. In this case, the execution block specifies a list of plug-in targets.
- Phase: This is the phase that executes the target list. This is a very powerful option that allows you to change maven’s default behavior by binding any target to any stage in the build life cycle.
- Setting this to false prevents Maven from passing execution to its children. This element is only meaningful to the parent POM.
- Configuration: Same as above, but restricts the configuration to this specific target list, rather than all targets under the plug-in.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>echodir</id>
<goals>
<goal>run</goal>
</goals>
<phase>verify</phase>
<inherited>false</inherited>
<configuration>
<tasks>
<echo>Build Dir: ${project.build.directory}</echo>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Copy the code
pluginManagement
Much like dependencyManagement, plug-ins are only declared in the current POM, not actually introduced. GroupId and artifactId are all configured in the child POM to reference the plug-in, and the child POM has the right to override the pluginManagement definition.
Its purpose is to unify plug-in versions of all child POMs.
directories
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<build>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<scriptSourceDirectory>${basedir}/src/main/scripts</scriptSourceDirectory>
<testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
<outputDirectory>${basedir}/target/classes</outputDirectory>
<testOutputDirectory>${basedir}/target/test-classes</testOutputDirectory>.</build>
</project>
Copy the code
The collection of directory elements exists in the Build element, which sets up various directory structures for the entire POM. Since they do not exist in the configuration file build, these cannot be changed by the configuration file.
This directory is used if the value of the above directory element is set to an absolute path (when extending the attribute). Otherwise, it is relative to the base build directory: ${basedir}.
extensions
The extension is a list of artifacts used in this build. They will be included in the classpath that runs the build. They enable extensions to the build process (such as adding an FTP provider to the Wagon transport mechanism) and enable active plug-ins to make changes to the build lifecycle. In short, extensions are artifacts that are activated during build time. The extension doesn’t actually do anything, and it doesn’t include moJOs. Therefore, extensions are good for specifying one of multiple implementations of a common plug-in interface.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<build>.<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0 - alpha - 3</version>
</extension>
</extensions>.</build>
</project>
Copy the code
reporting
The report contains elements specific to the site generation phase. Some Maven plug-ins can generate reports configured under the Reporting element, such as generating Javadoc reports. Reporting is similar to the build element’s ability to configure plug-ins. The obvious difference is that the control of the plug-in target in the execution block is not fine-grained and the report is finely controlled by configuring the reportSet element. The subtle difference is that the configuration element under the Reporting element can be used as the configuration element under the build element, Although the opposite is not true (configuration under build does not affect configuration under the Reporting element).
Another difference is the outputDirectory element under plugin. In the case of reporting, the default output directory is ${basedir}/target/site.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<reporting>
<plugins>
<plugin>.<reportSets>
<reportSet>
<id>sunlink</id>
<reports>
<report>javadoc</report>
</reports>
<inherited>true</inherited>
<configuration>
<links>
<link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
</links>
</configuration>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>.</project>
Copy the code
Project information
This part of the label related to the project information is not necessary, that is, do not fill in.
Its usefulness is limited to describing project details.
The following example is a list of tags associated with project information:
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<! -- Project information begin -->
<! -- Project name -->
<name>maven-notes</name>
<! -- Project Description -->
<description>Maven Learning Notes</description>
<! - project url -- -- >
<url>https://github.com/dunwu/maven-notes</url>
<! -- Project Development Year -->
<inceptionYear>2017</inceptionYear>
<! -- Open Source license -->
<licenses>
<license>
<name>The Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses>
<! -- Organization information (e.g. company, open source organization, etc.)-->
<organization>
<name>.</name>
<url>.</url>
</organization>
<! -- Developer List -->
<developers>
<developer>
<id>victor</id>
<name>Zhang Peng</name>
<email>forbreak at 163.com</email>
<url>https://github.com/dunwu</url>
<organization>.</organization>
<organizationUrl>.</organizationUrl>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
<timezone>+ 8</timezone>
<properties>.</properties>
</developer>
</developers>
<! -- List of contributors -->
<contributors>
<contributor>
<! -- Same tag content as <developer> -->
</contributor>
</contributors>
<! -- project information end -->.</project>
Copy the code
This part of the label is very simple, basically can do as the name implies, and all belong to the optional label, so here is just a brief introduction:
-
Name – Full name of the project
-
Description – Project description
-
Url – Typically the host of the project repository
-
InceptionYear – Development year
-
Licenses – Open source license
-
Organization – Information about the organization to which the project belongs
-
Developers – List of project developers
-
Ficolin-the list of project contributors, the subtags of < Contributor > are exactly the same as those of
.
Environment configuration
issueManagement
This defines the defect tracking system used (Bugzilla, TestTrack, ClearQuest, etc.). While there is nothing to prevent plug-ins from using this information, it is primarily used to generate project documentation.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<issueManagement>
<system>Bugzilla</system>
<url>http://127.0.0.1/bugzilla/</url>
</issueManagement>.</project>
Copy the code
ciManagement
CI builds the system configuration, which specifies the notification mechanism and the mailbox to be notified.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<ciManagement>
<system>continuum</system>
<url>http://127.0.0.1:8080/continuum</url>
<notifiers>
<notifier>
<type>mail</type>
<sendOnError>true</sendOnError>
<sendOnFailure>true</sendOnFailure>
<sendOnSuccess>false</sendOnSuccess>
<sendOnWarning>false</sendOnWarning>
<configuration><address>[email protected]</address></configuration>
</notifier>
</notifiers>
</ciManagement>.</project>
Copy the code
mailingLists
Mailing list,
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<mailingLists>
<mailingList>
<name>User List</name>
<subscribe>[email protected]</subscribe>
<unsubscribe>[email protected]</unsubscribe>
<post>[email protected]</post>
<archive>http://127.0.0.1/user/</archive>
<otherArchives>
<otherArchive>http://base.google.com/base/1/127.0.0.1</otherArchive>
</otherArchives>
</mailingList>
</mailingLists>.</project>
Copy the code
scm
SCM (software configuration management, also known as source/control management or concise version control). Common SCMS are SVN and Git.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<scm>
<connection>SCM: SVN: http://127.0.0.1/svn/my-project</connection>
<developerConnection>SCM: SVN: https://127.0.0.1/svn/my-project</developerConnection>
<tag>HEAD</tag>
<url>http://127.0.0.1/websvn/my-project</url>
</scm>.</project>
Copy the code
prerequisites
Default conditions for POM execution.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<prerequisites>
<maven>2.0.6</maven>
</prerequisites>.</project>
Copy the code
repositories
Repositories is a collection of artifacts following the Maven repository directory layout. The default Maven’s central repository at https://repo.maven.apache.org/maven2/.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<repositories>
<repository>
<releases>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<id>codehausSnapshots</id>
<name>Codehaus Snapshots</name>
<url>http://snapshots.maven.codehaus.org/maven2</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>.</pluginRepositories>.</project>
Copy the code
pluginRepositories
Something similar to Repositories.
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/001/XMLSchema-instance"
xsi:schemaLocation="Http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<distributionManagement>.<downloadUrl>http://mojo.codehaus.org/my-project</downloadUrl>
<status>deployed</status>
</distributionManagement>.</project>
Copy the code
distributionManagement
It manages the distribution of artifacts and supporting files generated throughout the build process. Start with the last element:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/001/XMLSchema-instance"
xsi:schemaLocation="Http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<distributionManagement>.<downloadUrl>http://mojo.codehaus.org/my-project</downloadUrl>
<status>deployed</status>
</distributionManagement>.</project>
Copy the code
-
Repository – Similar to repositories
-
Site – Site information
-
Relocation – Relocation location of the project
profiles
Activation is the key to a profile. The power of profiles comes from the ability to modify only the base POM in some cases. These conditions are specified by the activation element.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">.<profiles>
<profile>
<id>test</id>
<activation>
<activeByDefault>false</activeByDefault>
<jdk>1.5</jdk>
<os>
<name>Windows XP</name>
<family>Windows</family>
<arch>x86</arch>
<version>5.1.2600</version>
</os>
<property>
<name>sparrow-type</name>
<value>African</value>
</property>
<file>
<exists>${basedir}/file2.properties</exists>
<missing>${basedir}/file1.properties</missing>
</file>
</activation>.</profile>
</profiles>
</project>
Copy the code
The resources
- Maven official documentation poM