You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Bikash Chandra Barad <Bi...@planonsoftware.com> on 2017/10/10 11:26:45 UTC
Need to pass properties to the dependency POM file
Hi,
I am trying to grouping the dependencies into a pom(pom-deps.pom)file and adding that pom file as a dependency in my project.
I need to substitute the properties of the dependency pom file(pom-deps.pom) to get the latest version dependencies, like parent POM, from the dependency POM, in my project.
Is it possible to do so?
Regards,
Bikash Chandra
Re: Need to pass properties to the dependency POM file
Posted by Robert Patrick <ro...@oracle.com>.
Why not just use a top-level POM’s dependencyManagement section, in conjunction with top-level POM-defined properties if desired, to control the dependency versions?
> On Oct 10, 2017, at 6:56 AM, Bikash Chandra Barad <Bi...@planonsoftware.com> wrote:
>
> Hi Russell,
>
> I am not using it as import.
>
> POM
> ====
>
> <project>
> <groupId>org.sonatype.mavenbook</groupId>
> <artifactId>persistence-deps</artifactId>
> <version>1.0</version>
> <packaging>pom</packaging>
> <dependencies>
> <dependency>
> <groupId>org.hibernate</groupId>
> <artifactId>hibernate</artifactId>
> <version>${hibernateVersion}</version>
> </dependency>
> <dependency>
> <groupId>org.hibernate</groupId>
> <artifactId>hibernate-annotations</artifactId>
> <version>${hibernateAnnotationsVersion}</version>
> </dependency>
> <dependency>
> <groupId>org.springframework</groupId>
> <artifactId>spring-hibernate3</artifactId>
> <version>${springVersion}</version>
> </dependency>
> <dependency>
> <groupId>mysql</groupId>
> <artifactId>mysql-connector-java</artifactId>
> <version>${mysqlVersion}</version>
> </dependency>
> </dependencies>
> <properties>
> <mysqlVersion>(5.1,)</mysqlVersion>
> <springVersion>(2.0.6,)</springVersion>
> <hibernateVersion>3.2.5.ga</hibernateVersion>
> <hibernateAnnotationsVersion>3.3.0.ga</hibernateAnnotationsVersion>
> </properties>
> </project>
>
> Adding dependencies
> =================
>
> <project>
> <description>This is a project requiring JDBC</description>
> ...
> <dependencies>
> ...
> <dependency>
> <groupId>org.sonatype.mavenbook</groupId>
> <artifactId>persistence-deps</artifactId>
> <version>1.0</version>
> <type>pom</type>
> </dependency>
> </dependencies>
> </project>
>
> Regards,
> Bikash Chandra
>
> -----Original Message-----
> From: Russell Gold [mailto:russell.gold@oracle.com]
> Sent: Tuesday, October 10, 2017 5:13 PM
> To: Maven Users List <us...@maven.apache.org>
> Subject: Re: Need to pass properties to the dependency POM file
>
> Sounds as though you may want to use “import” scope https://urldefense.proofpoint.com/v2/url?u=https-3A__maven.apache.org_guides_introduction_introduction-2Dto-2Ddependency-2Dmechanism.html&d=DwIGaQ&c=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10&r=Ql5uwmbofQMW0iErugdCnFgO-CBGr_pt_OzwdxJosG0&m=55zhnJWrLDMAiuaB5pm9kC5cwEZ5DXWtGS3Rkle3obI&s=9YuWlEsrF5dB0MfahK--TN8Ud68aWuMMoilCQf6XGMA&e=
>
>> On Oct 10, 2017, at 7:26 AM, Bikash Chandra Barad <Bi...@planonsoftware.com> wrote:
>>
>> Hi,
>>
>> I am trying to grouping the dependencies into a pom(pom-deps.pom)file and adding that pom file as a dependency in my project.
>> I need to substitute the properties of the dependency pom file(pom-deps.pom) to get the latest version dependencies, like parent POM, from the dependency POM, in my project.
>> Is it possible to do so?
>>
>>
>> Regards,
>> Bikash Chandra
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Need to pass properties to the dependency POM file
Posted by Bikash Chandra Barad <Bi...@planonsoftware.com>.
Hi Russell,
I am not using it as import.
POM
====
<project>
<groupId>org.sonatype.mavenbook</groupId>
<artifactId>persistence-deps</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>${hibernateVersion}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>${hibernateAnnotationsVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-hibernate3</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysqlVersion}</version>
</dependency>
</dependencies>
<properties>
<mysqlVersion>(5.1,)</mysqlVersion>
<springVersion>(2.0.6,)</springVersion>
<hibernateVersion>3.2.5.ga</hibernateVersion>
<hibernateAnnotationsVersion>3.3.0.ga</hibernateAnnotationsVersion>
</properties>
</project>
Adding dependencies
=================
<project>
<description>This is a project requiring JDBC</description>
...
<dependencies>
...
<dependency>
<groupId>org.sonatype.mavenbook</groupId>
<artifactId>persistence-deps</artifactId>
<version>1.0</version>
<type>pom</type>
</dependency>
</dependencies>
</project>
Regards,
Bikash Chandra
-----Original Message-----
From: Russell Gold [mailto:russell.gold@oracle.com]
Sent: Tuesday, October 10, 2017 5:13 PM
To: Maven Users List <us...@maven.apache.org>
Subject: Re: Need to pass properties to the dependency POM file
Sounds as though you may want to use “import” scope https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
> On Oct 10, 2017, at 7:26 AM, Bikash Chandra Barad <Bi...@planonsoftware.com> wrote:
>
> Hi,
>
> I am trying to grouping the dependencies into a pom(pom-deps.pom)file and adding that pom file as a dependency in my project.
> I need to substitute the properties of the dependency pom file(pom-deps.pom) to get the latest version dependencies, like parent POM, from the dependency POM, in my project.
> Is it possible to do so?
>
>
> Regards,
> Bikash Chandra
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Need to pass properties to the dependency POM file
Posted by Russell Gold <ru...@oracle.com>.
Sounds as though you may want to use “import” scope https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
> On Oct 10, 2017, at 7:26 AM, Bikash Chandra Barad <Bi...@planonsoftware.com> wrote:
>
> Hi,
>
> I am trying to grouping the dependencies into a pom(pom-deps.pom)file and adding that pom file as a dependency in my project.
> I need to substitute the properties of the dependency pom file(pom-deps.pom) to get the latest version dependencies, like parent POM, from the dependency POM, in my project.
> Is it possible to do so?
>
>
> Regards,
> Bikash Chandra
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Need to pass properties to the dependency POM file
Posted by Anders Hammar <an...@hammar.net>.
No there isn't. The correct value needs to be in the pom (pom-deps) itself.
If then someone says you can specify the property values on the command
line as java system properties, it will not work as it will not update the
specified values in the pom-deps pom. Thus, the pom when deployed to the
repo will contain the old versions instead of the new ones used when
building.
/Anders
On Tue, Oct 10, 2017 at 1:26 PM, Bikash Chandra Barad <
BikashChandra.Barad@planonsoftware.com> wrote:
> Hi,
>
> I am trying to grouping the dependencies into a pom(pom-deps.pom)file
> and adding that pom file as a dependency in my project.
> I need to substitute the properties of the dependency pom
> file(pom-deps.pom) to get the latest version dependencies, like parent
> POM, from the dependency POM, in my project.
> Is it possible to do so?
>
>
> Regards,
> Bikash Chandra
>
>