This is great, thanks to all. I'm using dependencyManagement and also the
property declaration in the settings.xml that captures the version for the
entire project. Every where else, the version is softly referenced. e.g.

settings.xml: 
<profile>
        <id>frameworkVersion</id> 
        <properties>
                <framework.version>2.3</framework.version>
        </properties>
</profile>
<activeProfiles>
        <activeProfile>frameworkVersion</activeProfile>
</activeProfiles>

main pom:
<project>
        <groupId>com.mycompany.ixgf</groupId>
        <artifactId>ixgf</artifactId>
        <version>${framework.version}</version>
        ...

sub-module pom:
<project>
        <parent>
                <groupId>com.mycompany.ixgf</groupId>
                <artifactId>ixgf</artifactId>
                <version>${framework.version}</version>
        </parent>

        <dependencies>
                <dependency>
                        <groupId>com.mycompany.ixgf</groupId>
                        <artifactId>gw-core</artifactId>
                        <version>${framework.version}</version>
                </dependency>
        ...

The issue now is that the build only works from the top level pom. If you
try to build a sub-module independently, you'll get artifact resultion
errors, like below:

----------------------------------------------------------
GroupId: com.mycompany.ixgf
ArtifactId: ixgf
Version: ${framework.version}

Reason: Unable to download the artifact from any repository
----------------------------------------------------------


Looks like the property I defined in settings.xml is made available only to
the top level pom? 


Thanks


Rohnny Moland wrote:
> 
> I guess it should be possible to add something like:
> <properties>
>   <gw-plugin.version>1.0</gw-plugin.version>
> </properties>
> 
> ..to your pom or settings file.
> 
> HTH,
> Rohnny
> 
> hamdard wrote:
>> Hi
>> 
>> Is it possible to softcode the version in the dependency declaration?
>> 
>> For example, the pom could be like this:
>> 
>> <dependency>
>>      <groupId>com.mycompany.ixaf</groupId>
>>      <artifactId>gw-plugin</artifactId>
>>      <version>${myversion}</version>
>> </dependency>
>> 
>> And the myversion parameter is controllable from the settings.xml file.
>> 
>> The motivation is that if we have a multi-module build in maven with all
>> the
>> different modules using the same 'one' version, we could control/update
>> the
>> version of the entire project from one place (settings.xml), instead of
>> updating it in several places. 
>> 
>> Thanks
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-M2--How-to-softcode-%27version%27-in-dependency-declaration-tf2120609.html#a5854197
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to