Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Duplicate
-
Affects Version/s: 2.0.4
-
Fix Version/s: None
-
Component/s: Dependencies
-
Labels:None
-
Environment:WindowsXP/Linux - JDK 1.4 last version
-
Complexity:Intermediate
-
Number of attachments :
Description
root-project --> root-pom.xml with <version>${my.version}</version>
|------->proj1 <parent><version>${my.version}</version></parent>
| ------->proj2 <parent><version>${my.version}</version></parent> | | | |->proj1 dependency |------->proj3 <parent><version>${my.version}</version></parent> |
if I compile from the root-project directory, all compile fine.
if I compile from the proj2 directory, maven2 resolve proj2-${my.version}
resolve proj1-${my.version}
but tries to resolve the parent version root-project-${my.version} but this is not resolved.
Attachments
Issue Links
| This issue relates to: | ||||
| MNG-2412 | global variable filtering of pom.xml for parent and sub module pom.xml files is not working when deploying to a repository. |
|
|
|
| MNG-4369 | Maven does not expand expressions while installing artifacts locally |
|
|
|
| MNG-624 | automatic parent versioning |
|
|
|
| This issue is related to: | ||||
| MNG-3057 | properties not expanded in generated POMs when building A/B/C nested projects |
|
|
|
I think this is an major issue.
We have a complex build where we have poms that declare the modules and other poms that are used for inheritance.
We want one and only one definition of the version.
We do this via properties. In the api-base-pom, which is the parent of every project except the poms declaring the modules, we set a property:
This property is available for all projects that inherit from api-base-pom as well as for api-base-pom itself.
So we can use something like:
The problem is that the pom declaring the modules don't inherit from the api-base-pom. It would be anyway more intuitive to set the version property in the pom of the api folder, as this is the first one parsed for a build. But if we set the property there, it is only applicable within this pom. So we end up with a situation where we have to define the version property 3 times. We have to separate the pom's declaring the modules from the base-poms used for inheritance, to avoid cyclic references and to trigger certain packaging instructions at the right phase of the build.
What works is to set the version property via mvn install -D...
But the version property should be part of the pom, no question about this.
Basically I want to be able to declare a property that is available for all poms within the module build, regardless of inheritance relationships.
- api
- pom.xml (Module declaration)
- apibasepomDir
- api-base-pom
- someprojectDir
- pom <-- api-base-pom
- servicesDir
- pom.xml (Further module declaration)
- servicesbasepom
- services-base-pom <-- api-base-pom
- someServiceDir
- pom <-- services-base-pom
We want one and only one definition of the version. We do this via properties. In the api-base-pom, which is the parent of every project except the poms declaring the modules, we set a property: