All about Maven property reference

Anish Antony
Javarevisited
Published in
2 min readDec 29, 2020

--

In Maven, it exposes some built-in property related to settings, underlayer Java, operating system…etc. Also, it can define custom properties on the pom. Over this article, let's discuss the built-in properties of maven and the importance of custom property definition.

Photo by Tierra Mallorca on Unsplash

In maven pom.xml, a property is accessed by using ${property_name}. You can define your custom properties in Maven. Also, the maven supports a large scale of built-in properties. Here over this article, we will discuss all these kind of properties supported by maven.

What are the types of properties in Maven?

Maven supports a great set of property references. In pom.xml it can get the os configured properties, Java properties. You can also define your own properties on the parent pom and can refer those properties from the child. Let's discuss each of them here

Environment properties

These are the properties defined in the os level environment variables. Such as path variable value, java_home configured on os level…etc. For accessing the Environmental properties, add the prefix env before the variable like follows.

${env.PATH}
${env.MAVEN_HOME}
${env.JAVA_HOME}
${env.MY_ENV_VARIABLE}

Project Properties

--

--

Anish Antony
Javarevisited

Fullstack Developer | Blogger | Experience on Java, Python, React, Angular, Golang | http://www.behindjava.com