You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by hamdard <hs...@tiscali.co.uk> on 2006/08/17 12:12:16 UTC
[M2] How to softcode 'version' in dependency declaration
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
--
View this message in context: http://www.nabble.com/-M2--How-to-softcode-%27version%27-in-dependency-declaration-tf2120609.html#a5848660
Sent from the Maven - Users forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: [M2] How to softcode 'version' in dependency declaration
Posted by hamdard <hs...@tiscali.co.uk>.
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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
--
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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: [M2] How to softcode 'version' in dependency declaration
Posted by Rohnny Moland <rm...@gmail.com>.
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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: [M2] How to softcode 'version' in dependency declaration
Posted by Ma...@ubs.com.
Have a look at dependency management
(http://maven.apache.org/guides/introduction/introduction-to-dependency-
mechanism.html).
Cheers
-----Original Message-----
From: hamdard [mailto:hsajjad@tiscali.co.uk]
Sent: 17 August 2006 11:12
To: users@maven.apache.org
Subject: [M2] How to softcode 'version' in dependency declaration
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
--
View this message in context:
http://www.nabble.com/-M2--How-to-softcode-%27version%27-in-dependency-d
eclaration-tf2120609.html#a5848660
Sent from the Maven - Users forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Visit our website at http://www.ubs.com
This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org