Some knowledge of Maven Pom

Source: Internet
Author: User

Most of the entire (fan) (Yi) from the MAVEN official website of the doc Introduction to POM https://maven.apache.org/guides/introduction/introduction-to-the-pom.html

The POM (Project Obeject Model) is the most basic component unit in a MAVEN project,

1. Variables in the project variable/pom;

All elements that have only a single value can be used as variables. ${project.build.sourcedirectory}, ${project.groupid},${project.version}, the variables are prefixed with project, if they are prefixed with pom or are not prefixed at all, Do not use it because this form has been marked as obsolete (@deprecated)

Special variables (special Variables)

${project.basedir} directory where the current project is located

${project.baseuri} The directory in which the current project is located, presented as a URI and available after Maven 2.1.0

${maven.build.timestamp} timestamp represents the build start time, which is available after Maven 2.1.0-m

The ${maven.build.timestamp} timestamp can be interpreted as a specific time-date format, but the ' Maven.build.timestamp.format ' attribute is declared in the project <project> block. The code is as follows:

1 <Project>2   ...3   <Properties>4     <Maven.build.timestamp.format>Yyyy-mm-dd ' T ' HH:mm:ss ' Z '</Maven.build.timestamp.format>5   </Properties>6   ...7 </Project>

The specified format of ' Maven.build.timestamp.format ' is consistent with the format in ' Java.text.SimpleDateFormat '. If ' Maven.build.timestamp.format ' is not specified, then the default time-date format is the format of the code shown above.

You can also use the properties defined in the project as a variable. The example given by the official website Doc is to use the <properties> definition ' mavenversion ' as a variable.

1 <Project>2   ...3   <Properties>4     <mavenversion>2.1</mavenversion>5   </Properties>6   <Dependencies>7     <Dependency>8       <groupId>Org.apache.maven</groupId>9       <Artifactid>Maven-artifact</Artifactid>Ten       <version>${mavenversion}</version> One     </Dependency> A     <Dependency> -       <groupId>Org.apache.maven</groupId> -       <Artifactid>Maven-project</Artifactid> the       <version>${mavenversion}</version> -     </Dependency> -   </Dependencies> -   ... + </Project>

2. Project inheritance concept, with example;

3. Project aggregation concept, with example;

Some knowledge of Maven Pom

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.