As you see from the title, I want to ask that the case of in Maven 3 there is no support for $version in pom.xml anymore. Do we have to really write a constant every time in each project in every pom.xml and related configuration files again and again? How can we avoid doing this? How can we use a versioning method like $version?
Using a macro inside the top <version/>
element and the version in the <parent/>
element never worked in maven 2. It appeared to work, but caused nothing but confusion downstream. If that's not what you are talking about, please clarify your question.
The expression ${version}
is deprecated, you should use ${project.version}
instead, but both are still supported and you certainly don't need a custom property.
The following just works fine for me with Maven 3:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>services</artifactId>
<version>${project.version}</version>
<type>ejb</type>
</dependency>
And also have a look at my previous answer to Warning on using project.parent.version as the version of a module in Maven 3, the way you're using version
(based on what I saw in the comments in another answer) doesn't make much sense IMHO and Maven 3 actually kindly suggests to follow a best practice. Just inherit the version.