Let`s say we have 2 branches Infrastructure and Web. 
The project web-core depends on infra-persist. 
We want to be able to manage the versions of the infra-persist and 
at the same time have a default value of 0.0.1-SNAPSHOT if no version 
is specified.  

Infrastructure 
   infra-parent
   infra-persist
and others 

Web
  web-parent
  web-core
and others 

In web-core I have 
        <artifactId>web-core</artifactId>
        <packaging>jar</packaging>
        <version>${web.core.version}</version>
        <parent>
                <groupId>com.abc.xyz</groupId>
                <relativePath>../web-parent/pom.xml</relativePath>
                <artifactId>web-parent</artifactId>
                <version>${web.parent.version}</version>
        </parent>
        <dependencies>
                <dependency>
                        <groupId>com.abc.xyz</groupId>
                        <artifactId>infra-persist</artifactId>
                        <version>${infra.persist.version}</version>
                </dependency>

  
In web-parent I have 
        <version>${web.parent.version}</version>
        <description>Holds common settings</description>
        <properties>
                <web.parent.version>0.0.1-SNAPSHOT</web.parent.version>
                <web.core.version>${web.parent.version}</web.core.version>
                <infra.parent.version>0.0.1-SNAPSHOT</infra.parent.version>
                <infra.persist.version>0.0.1-SNAPSHOT</infra.persist.version>   
        
        </properties>
        <modules>
        <module>../web-core</module>
                <!-- and others -->
    </modules>

In infra-persist I have  :
    <artifactId>infra-persist</artifactId>
    <version>${infra.persist.version}<version> 
        <parent>
                <groupId>com.abc.xyz</groupId>
                <relativePath>../infra-parent/pom.xml</relativePath>
                <artifactId>infra-parent</artifactId>
                <!-- Even though the parent version is specified as a property 
                in the current pom maven doesn't take it into account -->
                <version>${infra.parent.version}</version>
        </parent>

In infra-parent I have : 
        <artifactId>infra-parent</artifactId>
        <version>${infra.parent.version}</version>
        <packaging>pom</packaging>      
        <properties>
                <infra.parent.version>0.0.1-SNAPSHOT</infra.parent.version>
                <infra.persist.version>0.0.1-SNAPSHOT</infra.persist.version>
        </properties>
        <modules>
        <module>../infra-persist</module>
    </modules>

        
My build of infra started from infra-parent with mvn clean install works. 
My build of we started from web-parent with mvn clean install fails with  


[INFO]
------------------------------------------------------------------------
[INFO] Building WEB interface 
[INFO]    task-segment: [clean, install]
[INFO]
------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory C:\4\Web\web-core\target
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
Downloading:
http://com.abc.xyz:8080/maven-proxy-webapp/repository/com/abc/xyz/infra-parent/${infra.parent.version}/infra-parent-${infra.parent.version}.pom
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Failed to resolve artifact.


The only way I can make it work is if i hardcode in infra-persist 
    <artifactId>infra-persist</artifactId>
    <version>${infra.persist.version}<version> 
        <parent>
                <groupId>com.abc.xyz</groupId>
                <relativePath>../infra-parent/pom.xml</relativePath>
                <artifactId>infra-parent</artifactId>
                <!-- Even though the parent version is specified as a property 
                in the current pom maven doesn't take it into account -->
                <version>0.0.1-SNAPSHOT</version>
        </parent>

Thank you for all your hints and ideas, 
Lucian
-- 
View this message in context: 
http://www.nabble.com/dependency-not-found---fails-to-replace-the-version-with-the-property-for-parent-pom-tp21488666p21488666.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to