Need to pass properties to the dependency POM file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Need to pass properties to the dependency POM file

Bikash Chandra Barad
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

Reply | Threaded
Open this post in threaded view
|

Re: Need to pass properties to the dependency POM file

Russell Gold-3
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 <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Need to pass properties to the dependency POM file

Anders Hammar
In reply to this post by Bikash Chandra Barad
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 <
[hidden email]> 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
>
>
Reply | Threaded
Open this post in threaded view
|

RE: Need to pass properties to the dependency POM file

Bikash Chandra Barad
In reply to this post by Russell Gold-3
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:[hidden email]]
Sent: Tuesday, October 10, 2017 5:13 PM
To: Maven Users List <[hidden email]>
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 <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Need to pass properties to the dependency POM file

Robert Patrick
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 <[hidden email]> 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:[hidden email]]
> Sent: Tuesday, October 10, 2017 5:13 PM
> To: Maven Users List <[hidden email]>
> 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 <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]