Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1069913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:29:23+00:00 2026-05-16T20:29:23+00:00

http://maven.apache.org/pom.html#Properties says property values are accessible anywhere within a POM. Should this read are

  • 0

http://maven.apache.org/pom.html#Properties says property “values are accessible anywhere within a POM”.

Should this read “are accessible in most places within a POM”?

I can specify the version of a dependency no problem like so:

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>${junit.version}</version>
    <scope>test</scope>
</dependency>

But what about the version of the project itself like so:

<project xmlns="http://maven.apache.org/POM/4.0.0" ...>

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycompany.app</groupId>
    <artifactId>my-app</artifactId>
    <version>${myversion}</version>

    <properties>
        <myversion>8</myversion>
    </properties>

    <modules>
        <module>alpha</module>
        <module>beta</module>
    </modules>
    ...

If I try this <version> will not take the value 8. Here I’ve defined ${myversion} in the pom but the same seems to be the case if I specify -Dmyversion=8 on the command line.

If one of the modules specifies its parent with a hardcoded version number like so:

<parent>
    <groupId>com.mycompany.app</groupId>
    <artifactId>my-app</artifactId>
    <version>8</version>
</parent>

When I try to build then when maven comes to look at the module’s pom it will say it cannot find the given parent pom with version 8.

However if I hardcode version in the parent to 8 as well, rather than using ${myversion}, then everything works fine.

So it seems to me that property substitution does not happen for the /project/version tag of the parent pom.

Is this the case or is there some other explanation for what I seem to be seeing?

Regards,

/George

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:29:23+00:00Added an answer on May 16, 2026 at 8:29 pm

    Property substitution is not allowed in /project/parent/(groupId|artifactId|version) or in /project/(groupId|artifactId|version) by design in Maven 2.x.

    So the rules are:

    • hard code the version in the top project/version element.
    • hard code the version in the project/parent/version element of children.
    • children inherit the version unless they want to override it
      • there is thus not need for a ${myversion} property
    • use ${project.groupId} and ${project.version} for inter module dependencies.

    You’ll find an infinite number of threads on this topic on the maven user list (see for example Pom Parent Version Properties) and I’ll just say that any attempt to workaround the above rules is wrong and doesn’t work.

    Version less parent will be allowed in Maven 3.1.

    See also

    • MNG-624
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my pom file: <project xmlns=http://maven.apache.org/POM/4.0.0 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd> <modelVersion>4.0.0</modelVersion> <groupId>com.sia.g7</groupId> <artifactId>sia</artifactId> <packaging>jar</packaging>
I run a simple CXF maven project http://cxf.apache.org/docs/using-cxf-with-maven.html , and get error below [INFO]
I'm building my project using the following POM: <project xmlns=http://maven.apache.org/POM/4.0.0 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd> <modelVersion>4.0.0</modelVersion>
Trying to create a multi module maven project in eclipse. Parent Pom.xml <project xmlns=http://maven.apache.org/POM/4.0.0
I'm using the m2Eclipse plugin ( http://m2eclipse.sonatype.org/ ) to handle maven modules in eclipse.
http://developer.yahoo.com/javascript/howto-proxy.html Are there disadvantages to this technique? The advantage is obvious, that you can
http://en.wikipedia.org/wiki/ICalendar I'm working to implement an export feature for events. The link above lists
http://en.wikipedia.org/wiki/Diamond_problem I know what it means, but what steps can I take to avoid
http://localhost:50034/Admin/Delete/723 Always needs this parameter to perform the action, however, if you go to
http://leepoint.net/notes-java/data/expressions/22compareobjects.html It turns out that defining equals() isn't trivial; in fact it's moderately hard

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.