Maven built-in implicit variable (for conversion)

Source: Internet
Author: User
Tags sonatype

Maven provides three implicit variables for accessing environment variables, pom information, and Maven settings.

Env

The env variable exposes the environment variables of your operating system or shell. For example, a reference to $ {env. Path} In Maven pom will be replaced by the $ {path} environment variable, and % PATH % in windows.

Projetc

The project variable exposes pom. You can use the path of the dot mark (.) 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: Valid tive-POM to view, you will see <finalname> org. sonatype. mavenbook-project-a </finalname>

 

 

  • $ {Basedir} project root directory
  • $ {Project. Build. Directory} build directory. The default value is target.
  • $ {Project. Build. outputdirectory}: output directory of the build process. The default value is target/classes.
  • $ {Project. Build. finalname} Name of the output. The default value is $ {project. artifactid}-$ {project. Version}
  • $ {Project. Packaging} packaging type. The default value is jar.
  • $ {Project. xxx} contents of any node in the current pom File

     

     

    Settings

    The settings variable exposes the maven settings information. You can use the dot mark (.) path to reference the element value in the settings. xml file. For example, $ {settings. Offline} Will reference ~ 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.