Maven variables

Using Maven's variables is an easy way to customize your pom.xml file automatically. The following table reports a complete list of these variables:

Variables

Description

${project.name}

This is the built-in property that contains the name of the project.

${project.artifactId}

This is the built-in property that contains the unique identifier of the artifact.

${project.description}

This is the built-in property that contains the description of the project.

${project.groupId}

This is the built-in property that contains the unique identifier of the group.

${project.baseUri}

This is the built-in property that contains the URI of the project.

${project.version}

This is the built-in property, equivalent to ${version}, containing the version of the project.

${project.parent.version}

${project.parent.groupId}

These are the built-in properties that contain the version or the group ID of the parent POM.

${basedir}

This is the built-in property representing the directory in which the pom.xml file is stored.

${project.build.directory}

This is a property, defined in the central Maven's POM, containing the path of the build directory. The default value is target.

${project.build.sourceDirectory}

${project.build.scriptSourceDirectory}

${project.build.testSourceDirectory}

This is a set of properties, containing the path of Java/script sources.

${project.build.outputDirectory}

${project.build.testOutputDirectory}

This is a set of properties, defined in the central Maven's POM, containing the directory in which class files are stored during the build process. The default value is target/classes.

${project.build.finalName}

This is the built-in property containing the final name of the file created when the built project is packaged.

${settings.localRepository}

This is an environment variable, containing the Maven2 installation folder.

${env.M2_HOME}

This is an environment variable containing the Maven2 installation folder.

${env.HOME}

This is the built-in property containing the user's home directory.

${env.PATH}

This is the built-in property containing the current path in which Maven is running.

${env.JAVA_HOME}

This is an environment variable specifying the path to the current JRE_HOME folder.

${ENV.*}

Through this suffix, we can access the OSes environment variables.

${settings.*}

Through this suffix, we can access the settings.xml variables.

${java.home} or ${java.version} or ${os.version} or ${user.home} or ${user.name}

The Java environment variables are accessible by Maven. Here, we report the most common Java environment's variables.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset