Maven built-in implicit variables

Source: Internet
Author: User
Tags sonatype

MAVEN provides three implicit variables that can be used to access environment variables, POM information, and maven Settings

Env

Env variable that exposes the environment variables of your operating system or shell. Like a pair of ${env in Maven Pom. The reference to PATH} will be replaced by the ${path} environment variable, which is%path% in Windows.

projetc

The project variable exposes the POM. You can use dot markers (.) The path to reference the value of the POM element. For example

<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.sonatype.mavenbook</groupId>
<artifactId>project-a</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<finalName>${project.groupId}-${project.artifactId}</finalName>
</build>
</project>

When you use MVN help:effective-pom view, you will see <finalName>org.sonatype.mavenbook-project-a</finalName>

${BASEDIR} project root directory ${project.build.directory} build directory, default to target ${project.build.outputdirectory} build process output directory, default to target/ Classes ${project.build.finalname} Output name, default is ${project.artifactid}-${project.version} ${project.packaging} package Type, The default is Jar ${project.xxx} The contents of any node of the current Pom file

Settings

The settings variable exposes MAVEN settings information. You can use dot markers (.) The path to reference the value of the element in the settings.xml file. For example, ${settings.offline} references the value of the offline element in the ~/.m2/settings.xml file.

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.