Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Maven Properties Reference: project.*, settings.*, env.*, and Custom POM Values

Maven properties let you reuse values across your build, parent POMs, profiles, plugins, and CI commands. This guide organizes the major property types, shows how interpolation works, and gives practical commands to inspect effective values.

Originally published on 2010-04-14; fully revised and updated.

Properties in Maven

How Maven resolves properties

Maven interpolates property expressions (for example, values like ${project.version}) from multiple sources: the project model, parent model, settings, environment variables, JVM system properties, and user-defined values. In practice, this is what allows the same POM to behave correctly on local machines and CI agents.

flowchart TD
    A[Read pom.xml] --> B[Load parent and super POM]
    B --> C[Read active settings and profiles]
    C --> D[Read JVM and environment values]
    D --> E[Interpolate property expressions]
    E --> F[Resolved values used by plugins and packaging]

The exact effective value can vary by active profile, command-line flags, and plugin behavior, so validation with Maven CLI commands is important before relying on a property in release automation.

Property sources compared

Use this as a quick decision table when choosing where a value should come from.

SourceExample expressionBest used forNotes
Built-in project location${basedir}Relative paths in builds and pluginsRepresents the directory containing pom.xml.
Project model (POM)${project.version}Artifact naming and plugin configuration${pom.*} forms are commonly seen as aliases in older content.
Build directories${project.build.directory}Output and generated filesTypically resolves to target unless overridden.
User settings${settings.localRepository}Repository paths and user-scoped configLoaded from user/global settings.xml.
Environment variables${env.M2_HOME}Host-specific runtime pathsDepends on variable presence in the shell/agent environment.
Java system properties${java.home}JVM/JDK-aware configurationComes from JVM system properties, not Maven POM fields.
Custom POM properties${my.filter.value}Team-defined reusable constantsDefined under <properties> in POM.
Parent model values${project.parent.version}Inheritance-aware buildsUseful in multi-module or corporate parent setups.
CLI user properties-Dmy.filter.value=overrideOne-off overrides in CI/CDGood for pipeline-specific toggles and temporary overrides.

Frequently used property expressions

Project and build values

  • ${basedir}
  • ${project.name}
  • ${project.version}
  • ${project.build.directory}
  • ${project.build.outputDirectory}
  • ${project.build.finalName}

Settings, environment, and JVM values

  • ${settings.localRepository}
  • ${env.M2_HOME}
  • ${java.version}
  • ${java.home}
  • ${user.home}

Parent POM values

Parent values are accessed through the project model (for example, ${project.parent.version}). For object-level context, the original post referenced the MavenProject API: org.apache.maven.project.MavenProject.

  • ${project.parent.groupId}
  • ${project.parent.artifactId}
  • ${project.parent.version}

Define and override custom properties

Define team-owned values once in <properties>, then reference them throughout plugins, resources, and build metadata.

<project>
  <properties>
    <my.filter.value>hello</my.filter.value>
    <artifact.suffix>internal</artifact.suffix>
  </properties>

  <build>
    <finalName>${project.artifactId}-${project.version}-${artifact.suffix}</finalName>
  </build>
</project>Code language: HTML, XML (xml)

You can override a custom property at runtime from the command line, which is common in CI pipelines.

mvn clean package -Dartifact.suffix=ci

Inspect effective values from the CLI

When in doubt, ask Maven directly for the evaluated result of a property expression.

mvn help:evaluate -Dexpression=project.version
mvn help:evaluate -Dexpression=project.build.directory
mvn help:evaluate -Dexpression=settings.localRepository
mvn help:evaluate -Dexpression=env.M2_HOME

To understand inherited values and profile effects, inspect the effective POM.

mvn help:effective-pomCode language: CSS (css)

Common pitfalls and best practices

  • Prefer explicit ${project.*} expressions for readability in modern builds.
  • Do not assume environment variables exist on every developer machine or CI runner.
  • Validate key properties with help:evaluate before release or deployment jobs.
  • Use custom properties for team conventions, then allow CI overrides with -D only where needed.
  • Be careful with older aliases and legacy examples from Maven 2-era posts.
  • In multi-module projects, confirm parent-derived values from the effective POM, not by assumption.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Maven Learning Resources: A Practical Study Plan with the Better Builds with Maven PDF

The original post shared one Maven book link. This revised guide preserves that resource and adds a practical learning workflow, comparison table, and hands-on Maven commands.

Read More

Maven CLI Options Reference: Practical Flags, Comparisons, and Command Examples

A structured Maven command-line reference for CI/CD and local builds, including option comparisons, workflow guidance, and ready-to-use mvn commands. Based on the original 2013 cheatsheet, updated for readability and operational use.

Read More

Maven2 Web Application Setup: Legacy Step-by-Step Guide with Build, Jetty, and Site Reporting

A practical Maven2-era walkthrough for creating a Java web app, running core build goals, and generating docs and reports from pom.xml. This revision keeps the original workflow but adds structure, comparisons, and implementation-ready snippets.

Read More

Maven Clover for Distributed Java Applications: Instrument, Collect, and Aggregate Coverage

Learn a practical Clover + Maven workflow for distributed test environments. This walkthrough covers instrumentation, remote execution, coverage file collection, and final report generation.

Read More

Maven Reporting Plugins: Configure Site Reports in pom.xml (All, Selective, and reportSets)

Maven reporting plugins generate project documentation during the site lifecycle and are configured in the reporting section of pom.xml. This guide shows how to run all reports, select specific ones, and structure reportSets cleanly.

Read More

Maven Profiles in Practice: Definition, Activation, and Reliable Multi-Environment Builds

Maven profiles let you customize one build for multiple environments without cloning POM files. This guide covers profile types, activation methods, CLI usage, and team-safe best practices.

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x