[ 
http://jira.codehaus.org/browse/MNG-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_93309
 ] 

Hans Dockter commented on MNG-2446:
-----------------------------------

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.

- 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:
{code:xml}
<properties>
     <krugle.api.version>1.0-SNAPSHOT</krugle.api.version>
 </properties>
{code}

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:

{code:xml}
<parent>
      <groupId>x</groupId>
      <artifactId>api-base-pom</artifactId>
      <version>${api.version}</version>
</parent>
{code}

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.


> parent Pom  properties not resolved for module dependencies
> -----------------------------------------------------------
>
>                 Key: MNG-2446
>                 URL: http://jira.codehaus.org/browse/MNG-2446
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Dependencies
>    Affects Versions: 2.0.4
>         Environment: WindowsXP/Linux - JDK 1.4 last version
>            Reporter: Jeremie Poutrin
>            Priority: Minor
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to