[
https://issues.apache.org/jira/browse/MNG-6237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16018434#comment-16018434
]
Karl Heinz Marbaise commented on MNG-6237:
------------------------------------------
The first thing which I see in your example project is that you are not using
the mechanisms which are in Maven itself to have a single location to maintain
versions of deps. This means you should use in your root pom:
{code:xml}
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
{code}
In all modules you can now use:
{code:xml}
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
{code}
So if you like to change the version of the junit dependency you only need to
change a single location in the root pom.
And yes it is at the moment not possible to overwrite a property via command
line like the example you have given. Apart from that the title of this issue
should be changed cause the value does not change during the build it is kept
without any modification.
> Property value during the same build should not change
> ------------------------------------------------------
>
> Key: MNG-6237
> URL: https://issues.apache.org/jira/browse/MNG-6237
> Project: Maven
> Issue Type: Bug
> Affects Versions: 3.3.3
> Reporter: Zoltan Haindrich
>
> I've encountered this problem in HIVE-14289.
> But now I know more...and I think I probably understand what's going on.
> Long story short, I would like to override some project property to use a
> different version of a dependency...however using
> {code}
> mvn install -Dhadoop.version=2.8.0
> {code}
> is not enough...that's what I've found out in that ticket.
> The problem is:
> * root project defines a property {{junit.version}}
> * there is a lib project which pulls in a dependency with that property
> * there is an app module which tries to use the lib in some way
> in this setup even thru the developer would like to override the version of
> {{junit.version}}, he can't really do it; because maven references to it
> anyway.
> I've created a samle project in which the root project contains a malformed
> version number; and in case it tries to use it, will end up with an artifact
> resolution error.
> I'm not sure if the problem is within maven or in some of its plugins...
> sample project:
> https://github.com/kgyrtkirk/mng-6237
> sample output:
> https://api.travis-ci.org/jobs/234037973/log.txt?deansi=true
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)