I know I am not SMX developer but I would like dependencyManagement section
rather than copying properties to subprojects.

Dependency management let subproject to change version of artifact, for
example:
parent:
<pom>
    <properties>
        <code_house.hsqldb.version>1.1.3-GA</code_house.hsqldb.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- hardcoded version, not possible to change it in modules -->
            <dependency>
                <groupId>xerces</groupId>
                <artifactId>xercesImpl</artifactId>
                <version>2.8.1</version>
            </dependency>
            <dependency>
                <groupId>hsqldb</groupId>
                <artifactId>hsqldb</artifactId>
                <version>${code_house.hsqldb.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
</pom>

And in subproject
<pom>
    <properties>
        <code_house.hsqldb.version>2.0-beta</code_house.hsqldb.version>
    </properties>

    <dependencies>
        <dependency>
            <!-- Maven will resolve 2.0-beta artifact, not 1.1.3-GA -->
            <groupId>hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
        </dependency>
    </dependencies>
</pom>

And at last - really good for pom optimization will be section with
dependencyManagement for org.apache.servicemix group. Maven don't resolve
this artifact when they build the project, so it's free to use:
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.servicemix</groupId>
                <artifactId>servicemix-jbi</artifactId>
                <version>${pom.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

And even more, when you do release Maven will put released version in place
${pom.version}! :)

Regards,
Luke

PS.. dependency coverage in SMX project isn't the best..


lhe77 wrote:
> 
> 
> +1 
> I would go for <dependencyManagement/> as well.
> 
> Regards
> Lars
> 
> 
> 
> Am Donnerstag 18 September 2008 15:26:46 schrieb Guillaume Nodet:
>> Currently, we're mostly using properties to define versions of our
>> dependencies. For example,
>> <properties>
>>    <jaxb.api.version>2.1</jaxb.api.version>
>> </properties>
>>
>> and later in a submodule:
>>
>>  <dependency>
>>     <groupId>javax.xml.bind</groupId>
>>     <artifactId>jaxb-api</artifactId>
>>     <version>${jaxb.api.version}</version>
>> </dependency>
>>
>> It seems that this way of handling dependencies does not work very well.
>> If another dependency uses the same mechanism but with a different
>> version, I've seen maven using the one from the dependency instead of
>> the one specified in the root pom.
>> I think we should change this mechanism and use the
>> <dependencyManagement/> section of the pom instead.
>>
>> Thoughts ?
> 
> 
> 


-----
Lukasz Dywicki,
Integration Developer
http://blog.dywicki.pl/
-- 
View this message in context: 
http://www.nabble.com/-DISCUSS--Dependency-management-in-poms-vs-properties-tp19552897p19566923.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Reply via email to