Quantcast

dependency question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

dependency question

Magnanao, Hector
I have to 2 java projects a and b in maven.  The B project uses the A build as a dependency.  How do I ensure the whenever the A project has a new build,  the B project will always use that latest build in A.  A is being built with a unique build number each time it gets built.  So is A has build # 10 as the newest build,  the B project has to use build #10 of A.


Hector Magnanao Jr.
SCM Analyst
SAP Fieldglass
Skype:  (331) 702-6142
Mobile:  (847) 857-8401
Email: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: dependency question

Russell Gold-3
The simplest way is simply to use a snapshot version of A. That way B will always use the latest snapshot. When you finally release A, you can have B point to the released version instead of the snapshot.

> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <[hidden email]> wrote:
>
> I have to 2 java projects a and b in maven.  The B project uses the A build as a dependency.  How do I ensure the whenever the A project has a new build,  the B project will always use that latest build in A.  A is being built with a unique build number each time it gets built.  So is A has build # 10 as the newest build,  the B project has to use build #10 of A.
>
>
> Hector Magnanao Jr.
> SCM Analyst
> SAP Fieldglass
> Skype:  (331) 702-6142
> Mobile:  (847) 857-8401
> Email: [hidden email]
>


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: dependency question

Robert Patrick
The other way is to use a version range in your dependency, which gives you a similar behavior as using a snapshot dependency.  Both approaches have their advantages and drawbacks...

-----Original Message-----
From: Russell Gold
Sent: Thursday, April 06, 2017 2:27 PM
To: Maven Users List
Subject: Re: dependency question

The simplest way is simply to use a snapshot version of A. That way B will always use the latest snapshot. When you finally release A, you can have B point to the released version instead of the snapshot.

> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <[hidden email]> wrote:
>
> I have to 2 java projects a and b in maven.  The B project uses the A build as a dependency.  How do I ensure the whenever the A project has a new build,  the B project will always use that latest build in A.  A is being built with a unique build number each time it gets built.  So is A has build # 10 as the newest build,  the B project has to use build #10 of A.
>
>
> Hector Magnanao Jr.
> SCM Analyst
> SAP Fieldglass
> Skype:  (331) 702-6142
> Mobile:  (847) 857-8401
> Email: [hidden email]
>


---------------------------------------------------------------------
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
|  
Report Content as Inappropriate

RE: dependency question

Magnanao, Hector
In reply to this post by Russell Gold-3
If the builds for A are always getting a unique build number as a snapshot build,  how am I sure that B will always get the latest snapshot of A ?  Is there a way to name the A snapshot builds with a unique build number each time for this scenario.

-----Original Message-----
From: Russell Gold [mailto:[hidden email]]
Sent: Thursday, April 6, 2017 2:27 PM
To: Maven Users List <[hidden email]>
Subject: Re: dependency question

The simplest way is simply to use a snapshot version of A. That way B will always use the latest snapshot. When you finally release A, you can have B point to the released version instead of the snapshot.

> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <[hidden email]> wrote:
>
> I have to 2 java projects a and b in maven.  The B project uses the A build as a dependency.  How do I ensure the whenever the A project has a new build,  the B project will always use that latest build in A.  A is being built with a unique build number each time it gets built.  So is A has build # 10 as the newest build,  the B project has to use build #10 of A.
>
>
> Hector Magnanao Jr.
> SCM Analyst
> SAP Fieldglass
> Skype:  (331) 702-6142
> Mobile:  (847) 857-8401
> Email: [hidden email]
>


---------------------------------------------------------------------
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
|  
Report Content as Inappropriate

RE: dependency question

Magnanao, Hector
In reply to this post by Robert Patrick
Can you give me an example of using a range in the pom file as a dependency ?

-----Original Message-----
From: Robert Patrick [mailto:[hidden email]]
Sent: Thursday, April 6, 2017 2:34 PM
To: Maven Users List <[hidden email]>
Subject: RE: dependency question

The other way is to use a version range in your dependency, which gives you a similar behavior as using a snapshot dependency.  Both approaches have their advantages and drawbacks...

-----Original Message-----
From: Russell Gold
Sent: Thursday, April 06, 2017 2:27 PM
To: Maven Users List
Subject: Re: dependency question

The simplest way is simply to use a snapshot version of A. That way B will always use the latest snapshot. When you finally release A, you can have B point to the released version instead of the snapshot.

> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <[hidden email]> wrote:
>
> I have to 2 java projects a and b in maven.  The B project uses the A build as a dependency.  How do I ensure the whenever the A project has a new build,  the B project will always use that latest build in A.  A is being built with a unique build number each time it gets built.  So is A has build # 10 as the newest build,  the B project has to use build #10 of A.
>
>
> Hector Magnanao Jr.
> SCM Analyst
> SAP Fieldglass
> Skype:  (331) 702-6142
> Mobile:  (847) 857-8401
> Email: [hidden email]
>


---------------------------------------------------------------------
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]


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: dependency question

Russell Gold-3
In reply to this post by Magnanao, Hector
That’s the way it works: when you specify a snapshot, it takes the latest.

There are some corner cases where it won’t. I think it only checks for a new snapshot every few hours or so, so if you are putting out a lot you might conceivably miss one. You can reset that if you need to
.

> On Apr 7, 2017, at 11:27 AM, Magnanao, Hector <[hidden email]> wrote:
>
> If the builds for A are always getting a unique build number as a snapshot build,  how am I sure that B will always get the latest snapshot of A ?  Is there a way to name the A snapshot builds with a unique build number each time for this scenario.
>
> -----Original Message-----
> From: Russell Gold [mailto:[hidden email]]
> Sent: Thursday, April 6, 2017 2:27 PM
> To: Maven Users List <[hidden email]>
> Subject: Re: dependency question
>
> The simplest way is simply to use a snapshot version of A. That way B will always use the latest snapshot. When you finally release A, you can have B point to the released version instead of the snapshot.
>
>> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <[hidden email]> wrote:
>>
>> I have to 2 java projects a and b in maven.  The B project uses the A build as a dependency.  How do I ensure the whenever the A project has a new build,  the B project will always use that latest build in A.  A is being built with a unique build number each time it gets built.  So is A has build # 10 as the newest build,  the B project has to use build #10 of A.
>>
>>
>> Hector Magnanao Jr.
>> SCM Analyst
>> SAP Fieldglass
>> Skype:  (331) 702-6142
>> Mobile:  (847) 857-8401
>> Email: [hidden email]
>>
>
>
> ---------------------------------------------------------------------
> 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]
>


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: dependency question

Robert Patrick
Typically, whenever you run a build that includes a snapshot dependency, Maven will go out to the remote repository(ies), if any, and download the maven-metadata.xml file for that dependency to compare it against the snapshot stored in your local Maven repository to see if there is a newer version that needs to be downloaded.  For example, when I run one of our builds, I see this in the build output when there is a newer snapshot version:

Downloading: http://myrepomanager.example.com/artifactory/my-repo/test/artifact/2.2-SNAPSHOT/maven-metadata.xml
Downloaded: http://myrepomanager.example.com/artifactory/my-repo/test/artifact/2.2-SNAPSHOT/maven-metadata.xml (766 B at 1.4 KB/sec)
Downloading: http://myrepomanager.example.com/artifactory/my-repo/test/artifact/2.2-SNAPSHOT/artifact-2.2-20170406.205529-591.pom
Downloaded: http://myrepomanager.example.com/artifactory/my-repo/test/artifact/2.2-SNAPSHOT/artifact-2.2-20170406.205529-591.pom (3 KB at 12.5 KB/sec)
Downloading: http://myrepomanager.example.com/artifactory/my-repo/test/artifact/2.2-SNAPSHOT/artifact-2.2-20170406.205529-591.jar
Downloaded: http://myrepomanager.example.com/artifactory/my-repo/test/artifact/2.2-SNAPSHOT/artifact-2.2-20170406.205529-591.jar (43 KB at 25.3 KB/sec)

And this output when there is not:

Downloading: http://myrepomanager.example.com/artifactory/my-repo/test/artifact/2.2-SNAPSHOT/maven-metadata.xml
Downloaded: http://myrepomanager.example.com/artifactory/my-repo/test/artifact/2.2-SNAPSHOT/maven-metadata.xml (766 B at 1.7 KB/sec)

Whether it downloads and checks the maven-metadata.xml file every time or periodically is (at least somewhat) controlled by the repository declaration in your POM/settings.xml for the repository's updatePolicy.  For example, this is what one of our builds uses:

            <snapshots>
                <enabled>false</enabled>
                <updatePolicy>always</updatePolicy>
                <checksumPolicy>fail</checksumPolicy>
            </snapshots>


-----Original Message-----
From: Russell Gold
Sent: Friday, April 07, 2017 10:30 AM
To: Maven Users List
Subject: Re: dependency question

That’s the way it works: when you specify a snapshot, it takes the latest.

There are some corner cases where it won’t. I think it only checks for a new snapshot every few hours or so, so if you are putting out a lot you might conceivably miss one. You can reset that if you need to .

> On Apr 7, 2017, at 11:27 AM, Magnanao, Hector <[hidden email]> wrote:
>
> If the builds for A are always getting a unique build number as a snapshot build,  how am I sure that B will always get the latest snapshot of A ?  Is there a way to name the A snapshot builds with a unique build number each time for this scenario.
>
> -----Original Message-----
> From: Russell Gold [mailto:[hidden email]]
> Sent: Thursday, April 6, 2017 2:27 PM
> To: Maven Users List <[hidden email]>
> Subject: Re: dependency question
>
> The simplest way is simply to use a snapshot version of A. That way B will always use the latest snapshot. When you finally release A, you can have B point to the released version instead of the snapshot.
>
>> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <[hidden email]> wrote:
>>
>> I have to 2 java projects a and b in maven.  The B project uses the A build as a dependency.  How do I ensure the whenever the A project has a new build,  the B project will always use that latest build in A.  A is being built with a unique build number each time it gets built.  So is A has build # 10 as the newest build,  the B project has to use build #10 of A.
>>
>>
>> Hector Magnanao Jr.
>> SCM Analyst
>> SAP Fieldglass
>> Skype:  (331) 702-6142
>> Mobile:  (847) 857-8401
>> Email: [hidden email]
>>
>
>
> ---------------------------------------------------------------------
> 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]
>


---------------------------------------------------------------------
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
|  
Report Content as Inappropriate

Re: dependency question

Karl Heinz Marbaise-3
In reply to this post by Russell Gold-3
Hi Russlel,
On 07/04/17 17:29, Russell Gold wrote:

> That’s the way it works: when you specify a snapshot, it takes the latest.

This is not 100% true, cause it depends on the update policy you have
defined in your settings either explicit or by default the updates will
be checked every 24 hours...

If you like to force this you can use mvn -U ...or define a different
updatePolicy in your settings.xml for the appropriate repository.

By using mvn -U you make sure for running this build Maven will check if
there are newer SNAPSHOT version available for dependencies which have
defined a SNAPSHOT version....

This is working for a single module project...but if you have a multi
module build (Project C: A1 build before A2) which takes for example 5
minutes to build ...this is no longer 100% true...

Now let us assume you have another project B which dependends on two
different artifacts (A1, A2) of Project C ...this means in consequence
those artifacts are build at two different times...

This means it could happen that your build of Project B consumes A2 from
build #10 but A1 from build #9 ...


In practical it usually works without any issue using the mvn -U ...but
you should be aware of this issue...


The only solution which I have found to make 100% sure is to use the
output during the build of the project A and use those parsed
informations about the SNAPSHOT versions and inject them into my current
build ...(https://github.com/khmarbaise/deployment-recorder-extension 
not ready yet)...

Kind regards
Karl Heinz Marbaise


>
> There are some corner cases where it won’t. I think it only checks for a new snapshot every few hours or so, so if you are putting out a lot you might conceivably miss one. You can reset that if you need to
> .
>> On Apr 7, 2017, at 11:27 AM, Magnanao, Hector <[hidden email]> wrote:
>>
>> If the builds for A are always getting a unique build number as a snapshot build,  how am I sure that B will always get the latest snapshot of A ?  Is there a way to name the A snapshot builds with a unique build number each time for this scenario.
>>
>> -----Original Message-----
>> From: Russell Gold [mailto:[hidden email]]
>> Sent: Thursday, April 6, 2017 2:27 PM
>> To: Maven Users List <[hidden email]>
>> Subject: Re: dependency question
>>
>> The simplest way is simply to use a snapshot version of A. That way B will always use the latest snapshot. When you finally release A, you can have B point to the released version instead of the snapshot.
>>
>>> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <[hidden email]> wrote:
>>>
>>> I have to 2 java projects a and b in maven.  The B project uses the A build as a dependency.  How do I ensure the whenever the A project has a new build,  the B project will always use that latest build in A.  A is being built with a unique build number each time it gets built.  So is A has build # 10 as the newest build,  the B project has to use build #10 of A.
>>>
>>>
>>> Hector Magnanao Jr.
>>> SCM Analyst
>>> SAP Fieldglass
>>> Skype:  (331) 702-6142
>>> Mobile:  (847) 857-8401
>>> Email: [hidden email]
>>>
>>
>>

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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: dependency question

Robert Patrick
In reply to this post by Magnanao, Hector
For example, if I want to depend on the latest version of the artifact un the 1.1.x version range, I would put:

<dependency>
    <groupId>test</groupId>
    <artifactId>myartifact</artifactId>
    <version>[1.1,1.1.999999999]
</dependency>

This says give me the latest version whose number is greater than or equal to 1.1 and less than or equal to 1.1. 999999999 (where I randomly chose 999999999 to be greater than any incremental version I will ever create.  

This version range can also be written [1.1, 1.2) where the close parent indicates a non-inclusive range end (i.e., less than 1.2).  The thing to be aware of with this syntax is that it also includes any pre-release versions of 1.2 (e.g., 1.2-alpha-1 is included).  For more information, please see section 3.4.3 of http://books.sonatype.com/mvnref-book/reference/pom-relationships-sect-project-dependencies.html and http://maven.apache.org/enforcer/enforcer-rules/versionRanges.html 


--
Robert Patrick <[hidden email]>
VP, OPC Development, Oracle Corporation
7460 Warren Pkwy, Ste. 300 Office: +1.972.963.2872
Frisco, TX 75034, USA Mobile: +1.469.556.9450

Professional Oracle WebLogic Server
by Robert Patrick, Gregory Nyberg, and Philip Aston
with Josh Bregman and Paul Done
Book Home Page: http://www.wrox.com/
Kindle Version: http://www.amazon.com/


-----Original Message-----
From: Magnanao, Hector [mailto:[hidden email]]
Sent: Friday, April 07, 2017 10:28 AM
To: Maven Users List
Subject: RE: dependency question

Can you give me an example of using a range in the pom file as a dependency ?

-----Original Message-----
From: Robert Patrick [mailto:[hidden email]]
Sent: Thursday, April 6, 2017 2:34 PM
To: Maven Users List <[hidden email]>
Subject: RE: dependency question

The other way is to use a version range in your dependency, which gives you a similar behavior as using a snapshot dependency.  Both approaches have their advantages and drawbacks...

-----Original Message-----
From: Russell Gold
Sent: Thursday, April 06, 2017 2:27 PM
To: Maven Users List
Subject: Re: dependency question

The simplest way is simply to use a snapshot version of A. That way B will always use the latest snapshot. When you finally release A, you can have B point to the released version instead of the snapshot.

> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <[hidden email]> wrote:
>
> I have to 2 java projects a and b in maven.  The B project uses the A build as a dependency.  How do I ensure the whenever the A project has a new build,  the B project will always use that latest build in A.  A is being built with a unique build number each time it gets built.  So is A has build # 10 as the newest build,  the B project has to use build #10 of A.
>
>
> Hector Magnanao Jr.
> SCM Analyst
> SAP Fieldglass
> Skype:  (331) 702-6142
> Mobile:  (847) 857-8401
> Email: [hidden email]
>


---------------------------------------------------------------------
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]


---------------------------------------------------------------------
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
|  
Report Content as Inappropriate

RE: dependency question

Magnanao, Hector
In reply to this post by Karl Heinz Marbaise-3
I'm still a little confused about the answers I'm getting.  So, if build A is being updated with a new build number(even for a snapshot), and build B has it as a dependency in it's pom.file, how does the pom file in Build B need to look like in the dependency section so that it does get the latest snapshot build of build A ?

Scenario:

Build A has 3 builds in it with names 1-Snapshot, 2-snapshot, 3-snapshot and they are all being uploaded to a repository.

What will the pom file in build B look like so that the next time build B is executed,  3-snapshot for build A will be picked up ?

-----Original Message-----
From: Karl Heinz Marbaise [mailto:[hidden email]]
Sent: Friday, April 7, 2017 10:50 AM
To: Maven Users List <[hidden email]>
Subject: Re: dependency question

Hi Russlel,
On 07/04/17 17:29, Russell Gold wrote:

> That’s the way it works: when you specify a snapshot, it takes the latest.

This is not 100% true, cause it depends on the update policy you have
defined in your settings either explicit or by default the updates will
be checked every 24 hours...

If you like to force this you can use mvn -U ...or define a different
updatePolicy in your settings.xml for the appropriate repository.

By using mvn -U you make sure for running this build Maven will check if
there are newer SNAPSHOT version available for dependencies which have
defined a SNAPSHOT version....

This is working for a single module project...but if you have a multi
module build (Project C: A1 build before A2) which takes for example 5
minutes to build ...this is no longer 100% true...

Now let us assume you have another project B which dependends on two
different artifacts (A1, A2) of Project C ...this means in consequence
those artifacts are build at two different times...

This means it could happen that your build of Project B consumes A2 from
build #10 but A1 from build #9 ...


In practical it usually works without any issue using the mvn -U ...but
you should be aware of this issue...


The only solution which I have found to make 100% sure is to use the
output during the build of the project A and use those parsed
informations about the SNAPSHOT versions and inject them into my current
build ...(https://github.com/khmarbaise/deployment-recorder-extension 
not ready yet)...

Kind regards
Karl Heinz Marbaise


>
> There are some corner cases where it won’t. I think it only checks for a new snapshot every few hours or so, so if you are putting out a lot you might conceivably miss one. You can reset that if you need to
> .
>> On Apr 7, 2017, at 11:27 AM, Magnanao, Hector <[hidden email]> wrote:
>>
>> If the builds for A are always getting a unique build number as a snapshot build,  how am I sure that B will always get the latest snapshot of A ?  Is there a way to name the A snapshot builds with a unique build number each time for this scenario.
>>
>> -----Original Message-----
>> From: Russell Gold [mailto:[hidden email]]
>> Sent: Thursday, April 6, 2017 2:27 PM
>> To: Maven Users List <[hidden email]>
>> Subject: Re: dependency question
>>
>> The simplest way is simply to use a snapshot version of A. That way B will always use the latest snapshot. When you finally release A, you can have B point to the released version instead of the snapshot.
>>
>>> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <[hidden email]> wrote:
>>>
>>> I have to 2 java projects a and b in maven.  The B project uses the A build as a dependency.  How do I ensure the whenever the A project has a new build,  the B project will always use that latest build in A.  A is being built with a unique build number each time it gets built.  So is A has build # 10 as the newest build,  the B project has to use build #10 of A.
>>>
>>>
>>> Hector Magnanao Jr.
>>> SCM Analyst
>>> SAP Fieldglass
>>> Skype:  (331) 702-6142
>>> Mobile:  (847) 857-8401
>>> Email: [hidden email]
>>>
>>
>>

---------------------------------------------------------------------
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
|  
Report Content as Inappropriate

Re: dependency question

Benson Margulies
On Mon, Apr 10, 2017 at 8:18 AM, Magnanao, Hector
<[hidden email]> wrote:
> I'm still a little confused about the answers I'm getting.  So, if build A is being updated with a new build number(even for a snapshot), and build B has it as a dependency in it's pom.file, how does the pom file in Build B need to look like in the dependency section so that it does get the latest snapshot build of build A ?

This conversation seems to keep mixing up SNAPSHOT version processing
with various conventions for using version ranges.

If the producer produces x.y.z-SNAPSHOT, and the consumer declares a
dependency on x.y.z-SNAPSHOT, every build of the consumer will go out
to the repositories to look for the latest snapshot build.

Snapshots have risks and do not provide a repeatable build. Then
again, neither do ranges.

If you don't want to use snapshots, then you write the dependency in
the consumer with a range

    (1.0-2.0]

or whatever makes sense. This will cause builds of the consumer to go
out to repositories and try to find the newest version within the
range. it's up to you to bump the version in the producer, manually or
with the maven-release-plugin.




>
> Scenario:
>
> Build A has 3 builds in it with names 1-Snapshot, 2-snapshot, 3-snapshot and they are all being uploaded to a repository.
>
> What will the pom file in build B look like so that the next time build B is executed,  3-snapshot for build A will be picked up ?
>
> -----Original Message-----
> From: Karl Heinz Marbaise [mailto:[hidden email]]
> Sent: Friday, April 7, 2017 10:50 AM
> To: Maven Users List <[hidden email]>
> Subject: Re: dependency question
>
> Hi Russlel,
> On 07/04/17 17:29, Russell Gold wrote:
>
>> That’s the way it works: when you specify a snapshot, it takes the latest.
>
> This is not 100% true, cause it depends on the update policy you have
> defined in your settings either explicit or by default the updates will
> be checked every 24 hours...
>
> If you like to force this you can use mvn -U ...or define a different
> updatePolicy in your settings.xml for the appropriate repository.
>
> By using mvn -U you make sure for running this build Maven will check if
> there are newer SNAPSHOT version available for dependencies which have
> defined a SNAPSHOT version....
>
> This is working for a single module project...but if you have a multi
> module build (Project C: A1 build before A2) which takes for example 5
> minutes to build ...this is no longer 100% true...
>
> Now let us assume you have another project B which dependends on two
> different artifacts (A1, A2) of Project C ...this means in consequence
> those artifacts are build at two different times...
>
> This means it could happen that your build of Project B consumes A2 from
> build #10 but A1 from build #9 ...
>
>
> In practical it usually works without any issue using the mvn -U ...but
> you should be aware of this issue...
>
>
> The only solution which I have found to make 100% sure is to use the
> output during the build of the project A and use those parsed
> informations about the SNAPSHOT versions and inject them into my current
> build ...(https://github.com/khmarbaise/deployment-recorder-extension
> not ready yet)...
>
> Kind regards
> Karl Heinz Marbaise
>
>
>>
>> There are some corner cases where it won’t. I think it only checks for a new snapshot every few hours or so, so if you are putting out a lot you might conceivably miss one. You can reset that if you need to
>> .
>>> On Apr 7, 2017, at 11:27 AM, Magnanao, Hector <[hidden email]> wrote:
>>>
>>> If the builds for A are always getting a unique build number as a snapshot build,  how am I sure that B will always get the latest snapshot of A ?  Is there a way to name the A snapshot builds with a unique build number each time for this scenario.
>>>
>>> -----Original Message-----
>>> From: Russell Gold [mailto:[hidden email]]
>>> Sent: Thursday, April 6, 2017 2:27 PM
>>> To: Maven Users List <[hidden email]>
>>> Subject: Re: dependency question
>>>
>>> The simplest way is simply to use a snapshot version of A. That way B will always use the latest snapshot. When you finally release A, you can have B point to the released version instead of the snapshot.
>>>
>>>> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <[hidden email]> wrote:
>>>>
>>>> I have to 2 java projects a and b in maven.  The B project uses the A build as a dependency.  How do I ensure the whenever the A project has a new build,  the B project will always use that latest build in A.  A is being built with a unique build number each time it gets built.  So is A has build # 10 as the newest build,  the B project has to use build #10 of A.
>>>>
>>>>
>>>> Hector Magnanao Jr.
>>>> SCM Analyst
>>>> SAP Fieldglass
>>>> Skype:  (331) 702-6142
>>>> Mobile:  (847) 857-8401
>>>> Email: [hidden email]
>>>>
>>>
>>>
>
> ---------------------------------------------------------------------
> 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
|  
Report Content as Inappropriate

RE: dependency question

Magnanao, Hector
This is fine as long as the dependency is always set to x.y.z-Snapshot and the dependency is always overwritten this way.  What if the producer produces x.y.z.1-Snapshot, x.y.z.2-Snapshot, x.y.z.3-Snapshot and I want the dependent build to always get the latest in this case,  x.y.z.3-Snapshot ? The difference with this scenario is that the producer will always have a new build number.
As for your solution of using the range,  do I always have to change the pom file in the dependent build whenever a new build is produced by the producer ?

-----Original Message-----
From: Benson Margulies [mailto:[hidden email]]
Sent: Monday, April 10, 2017 10:39 AM
To: Maven Users List <[hidden email]>
Subject: Re: dependency question

On Mon, Apr 10, 2017 at 8:18 AM, Magnanao, Hector
<[hidden email]> wrote:
> I'm still a little confused about the answers I'm getting.  So, if build A is being updated with a new build number(even for a snapshot), and build B has it as a dependency in it's pom.file, how does the pom file in Build B need to look like in the dependency section so that it does get the latest snapshot build of build A ?

This conversation seems to keep mixing up SNAPSHOT version processing
with various conventions for using version ranges.

If the producer produces x.y.z-SNAPSHOT, and the consumer declares a
dependency on x.y.z-SNAPSHOT, every build of the consumer will go out
to the repositories to look for the latest snapshot build.

Snapshots have risks and do not provide a repeatable build. Then
again, neither do ranges.

If you don't want to use snapshots, then you write the dependency in
the consumer with a range

    (1.0-2.0]

or whatever makes sense. This will cause builds of the consumer to go
out to repositories and try to find the newest version within the
range. it's up to you to bump the version in the producer, manually or
with the maven-release-plugin.




>
> Scenario:
>
> Build A has 3 builds in it with names 1-Snapshot, 2-snapshot, 3-snapshot and they are all being uploaded to a repository.
>
> What will the pom file in build B look like so that the next time build B is executed,  3-snapshot for build A will be picked up ?
>
> -----Original Message-----
> From: Karl Heinz Marbaise [mailto:[hidden email]]
> Sent: Friday, April 7, 2017 10:50 AM
> To: Maven Users List <[hidden email]>
> Subject: Re: dependency question
>
> Hi Russlel,
> On 07/04/17 17:29, Russell Gold wrote:
>
>> That’s the way it works: when you specify a snapshot, it takes the latest.
>
> This is not 100% true, cause it depends on the update policy you have
> defined in your settings either explicit or by default the updates will
> be checked every 24 hours...
>
> If you like to force this you can use mvn -U ...or define a different
> updatePolicy in your settings.xml for the appropriate repository.
>
> By using mvn -U you make sure for running this build Maven will check if
> there are newer SNAPSHOT version available for dependencies which have
> defined a SNAPSHOT version....
>
> This is working for a single module project...but if you have a multi
> module build (Project C: A1 build before A2) which takes for example 5
> minutes to build ...this is no longer 100% true...
>
> Now let us assume you have another project B which dependends on two
> different artifacts (A1, A2) of Project C ...this means in consequence
> those artifacts are build at two different times...
>
> This means it could happen that your build of Project B consumes A2 from
> build #10 but A1 from build #9 ...
>
>
> In practical it usually works without any issue using the mvn -U ...but
> you should be aware of this issue...
>
>
> The only solution which I have found to make 100% sure is to use the
> output during the build of the project A and use those parsed
> informations about the SNAPSHOT versions and inject them into my current
> build ...(https://github.com/khmarbaise/deployment-recorder-extension
> not ready yet)...
>
> Kind regards
> Karl Heinz Marbaise
>
>
>>
>> There are some corner cases where it won’t. I think it only checks for a new snapshot every few hours or so, so if you are putting out a lot you might conceivably miss one. You can reset that if you need to
>> .
>>> On Apr 7, 2017, at 11:27 AM, Magnanao, Hector <[hidden email]> wrote:
>>>
>>> If the builds for A are always getting a unique build number as a snapshot build,  how am I sure that B will always get the latest snapshot of A ?  Is there a way to name the A snapshot builds with a unique build number each time for this scenario.
>>>
>>> -----Original Message-----
>>> From: Russell Gold [mailto:[hidden email]]
>>> Sent: Thursday, April 6, 2017 2:27 PM
>>> To: Maven Users List <[hidden email]>
>>> Subject: Re: dependency question
>>>
>>> The simplest way is simply to use a snapshot version of A. That way B will always use the latest snapshot. When you finally release A, you can have B point to the released version instead of the snapshot.
>>>
>>>> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <[hidden email]> wrote:
>>>>
>>>> I have to 2 java projects a and b in maven.  The B project uses the A build as a dependency.  How do I ensure the whenever the A project has a new build,  the B project will always use that latest build in A.  A is being built with a unique build number each time it gets built.  So is A has build # 10 as the newest build,  the B project has to use build #10 of A.
>>>>
>>>>
>>>> Hector Magnanao Jr.
>>>> SCM Analyst
>>>> SAP Fieldglass
>>>> Skype:  (331) 702-6142
>>>> Mobile:  (847) 857-8401
>>>> Email: [hidden email]
>>>>
>>>
>>>
>
> ---------------------------------------------------------------------
> 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]


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

Re: dependency question

Curtis Rueden
Hi Hector,

> This is fine as long as the dependency is always set to x.y.z-Snapshot
> and the dependency is always overwritten this way.  What if the
> producer produces x.y.z.1-Snapshot, x.y.z.2-Snapshot, x.y.z.3-Snapshot
> and I want the dependent build to always get the latest in this case,
> x.y.z.3-Snapshot ?

There is a special version keyword LATEST which means the very newest
version, snapshot or otherwise. And RELEASE means the newest release
(non-SNAPSHOT) version.

Similar to version ranges, Maven will have to ask the remote repository
about the latest known version in these cases, and will then use that.

I want to emphasize, as others have mentioned, that using any of these
strategies will result in _irreproducible builds_. That is, your code might
build today, and then the same code will fail to build in the future,
because the versions will resolve differently. The only way (I know of) to
achieve reproducible builds is to use fixed release versions, always.

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden


On Tue, Apr 11, 2017 at 9:57 AM, Magnanao, Hector <[hidden email]>
wrote:

> This is fine as long as the dependency is always set to x.y.z-Snapshot and
> the dependency is always overwritten this way.  What if the producer
> produces x.y.z.1-Snapshot, x.y.z.2-Snapshot, x.y.z.3-Snapshot and I want
> the dependent build to always get the latest in this case,
> x.y.z.3-Snapshot ? The difference with this scenario is that the producer
> will always have a new build number.
> As for your solution of using the range,  do I always have to change the
> pom file in the dependent build whenever a new build is produced by the
> producer ?
>
> -----Original Message-----
> From: Benson Margulies [mailto:[hidden email]]
> Sent: Monday, April 10, 2017 10:39 AM
> To: Maven Users List <[hidden email]>
> Subject: Re: dependency question
>
> On Mon, Apr 10, 2017 at 8:18 AM, Magnanao, Hector
> <[hidden email]> wrote:
> > I'm still a little confused about the answers I'm getting.  So, if build
> A is being updated with a new build number(even for a snapshot), and build
> B has it as a dependency in it's pom.file, how does the pom file in Build B
> need to look like in the dependency section so that it does get the latest
> snapshot build of build A ?
>
> This conversation seems to keep mixing up SNAPSHOT version processing
> with various conventions for using version ranges.
>
> If the producer produces x.y.z-SNAPSHOT, and the consumer declares a
> dependency on x.y.z-SNAPSHOT, every build of the consumer will go out
> to the repositories to look for the latest snapshot build.
>
> Snapshots have risks and do not provide a repeatable build. Then
> again, neither do ranges.
>
> If you don't want to use snapshots, then you write the dependency in
> the consumer with a range
>
>     (1.0-2.0]
>
> or whatever makes sense. This will cause builds of the consumer to go
> out to repositories and try to find the newest version within the
> range. it's up to you to bump the version in the producer, manually or
> with the maven-release-plugin.
>
>
>
>
> >
> > Scenario:
> >
> > Build A has 3 builds in it with names 1-Snapshot, 2-snapshot, 3-snapshot
> and they are all being uploaded to a repository.
> >
> > What will the pom file in build B look like so that the next time build
> B is executed,  3-snapshot for build A will be picked up ?
> >
> > -----Original Message-----
> > From: Karl Heinz Marbaise [mailto:[hidden email]]
> > Sent: Friday, April 7, 2017 10:50 AM
> > To: Maven Users List <[hidden email]>
> > Subject: Re: dependency question
> >
> > Hi Russlel,
> > On 07/04/17 17:29, Russell Gold wrote:
> >
> >> That’s the way it works: when you specify a snapshot, it takes the
> latest.
> >
> > This is not 100% true, cause it depends on the update policy you have
> > defined in your settings either explicit or by default the updates will
> > be checked every 24 hours...
> >
> > If you like to force this you can use mvn -U ...or define a different
> > updatePolicy in your settings.xml for the appropriate repository.
> >
> > By using mvn -U you make sure for running this build Maven will check if
> > there are newer SNAPSHOT version available for dependencies which have
> > defined a SNAPSHOT version....
> >
> > This is working for a single module project...but if you have a multi
> > module build (Project C: A1 build before A2) which takes for example 5
> > minutes to build ...this is no longer 100% true...
> >
> > Now let us assume you have another project B which dependends on two
> > different artifacts (A1, A2) of Project C ...this means in consequence
> > those artifacts are build at two different times...
> >
> > This means it could happen that your build of Project B consumes A2 from
> > build #10 but A1 from build #9 ...
> >
> >
> > In practical it usually works without any issue using the mvn -U ...but
> > you should be aware of this issue...
> >
> >
> > The only solution which I have found to make 100% sure is to use the
> > output during the build of the project A and use those parsed
> > informations about the SNAPSHOT versions and inject them into my current
> > build ...(https://github.com/khmarbaise/deployment-recorder-extension
> > not ready yet)...
> >
> > Kind regards
> > Karl Heinz Marbaise
> >
> >
> >>
> >> There are some corner cases where it won’t. I think it only checks for
> a new snapshot every few hours or so, so if you are putting out a lot you
> might conceivably miss one. You can reset that if you need to
> >> .
> >>> On Apr 7, 2017, at 11:27 AM, Magnanao, Hector <[hidden email]>
> wrote:
> >>>
> >>> If the builds for A are always getting a unique build number as a
> snapshot build,  how am I sure that B will always get the latest snapshot
> of A ?  Is there a way to name the A snapshot builds with a unique build
> number each time for this scenario.
> >>>
> >>> -----Original Message-----
> >>> From: Russell Gold [mailto:[hidden email]]
> >>> Sent: Thursday, April 6, 2017 2:27 PM
> >>> To: Maven Users List <[hidden email]>
> >>> Subject: Re: dependency question
> >>>
> >>> The simplest way is simply to use a snapshot version of A. That way B
> will always use the latest snapshot. When you finally release A, you can
> have B point to the released version instead of the snapshot.
> >>>
> >>>> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <[hidden email]>
> wrote:
> >>>>
> >>>> I have to 2 java projects a and b in maven.  The B project uses the A
> build as a dependency.  How do I ensure the whenever the A project has a
> new build,  the B project will always use that latest build in A.  A is
> being built with a unique build number each time it gets built.  So is A
> has build # 10 as the newest build,  the B project has to use build #10 of
> A.
> >>>>
> >>>>
> >>>> Hector Magnanao Jr.
> >>>> SCM Analyst
> >>>> SAP Fieldglass
> >>>> Skype:  (331) 702-6142
> >>>> Mobile:  (847) 857-8401
> >>>> Email: [hidden email]
> >>>>
> >>>
> >>>
> >
> > ---------------------------------------------------------------------
> > 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]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: dependency question

stephenconnolly
On Tue 11 Apr 2017 at 16:02, Curtis Rueden <[hidden email]> wrote:

> Hi Hector,
>
> > This is fine as long as the dependency is always set to x.y.z-Snapshot
> > and the dependency is always overwritten this way.  What if the
> > producer produces x.y.z.1-Snapshot, x.y.z.2-Snapshot, x.y.z.3-Snapshot
> > and I want the dependent build to always get the latest in this case,
> > x.y.z.3-Snapshot ?
>
> There is a special version keyword LATEST which means the very newest
> version, snapshot or otherwise. And RELEASE means the newest release
> (non-SNAPSHOT) version.


Support for those were dropped in Maven 3

*and* anyway they were only for *plugin* versions because the plugin
version does not support ranges.

For dependency versions, define a range

>
>
> Similar to version ranges, Maven will have to ask the remote repository
> about the latest known version in these cases, and will then use that.
>
> I want to emphasize, as others have mentioned, that using any of these
> strategies will result in _irreproducible builds_. That is, your code might
> build today, and then the same code will fail to build in the future,
> because the versions will resolve differently. The only way (I know of) to
> achieve reproducible builds is to use fixed release versions, always.
>
> Regards,
> Curtis
>
> --
> Curtis Rueden
> LOCI software architect - https://loci.wisc.edu/software
> ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
>
>
> On Tue, Apr 11, 2017 at 9:57 AM, Magnanao, Hector <[hidden email]
> >
> wrote:
>
> > This is fine as long as the dependency is always set to x.y.z-Snapshot
> and
> > the dependency is always overwritten this way.  What if the producer
> > produces x.y.z.1-Snapshot, x.y.z.2-Snapshot, x.y.z.3-Snapshot and I want
> > the dependent build to always get the latest in this case,
> > x.y.z.3-Snapshot ? The difference with this scenario is that the producer
> > will always have a new build number.
> > As for your solution of using the range,  do I always have to change the
> > pom file in the dependent build whenever a new build is produced by the
> > producer ?
> >
> > -----Original Message-----
> > From: Benson Margulies [mailto:[hidden email]]
> > Sent: Monday, April 10, 2017 10:39 AM
> > To: Maven Users List <[hidden email]>
> > Subject: Re: dependency question
> >
> > On Mon, Apr 10, 2017 at 8:18 AM, Magnanao, Hector
> > <[hidden email]> wrote:
> > > I'm still a little confused about the answers I'm getting.  So, if
> build
> > A is being updated with a new build number(even for a snapshot), and
> build
> > B has it as a dependency in it's pom.file, how does the pom file in
> Build B
> > need to look like in the dependency section so that it does get the
> latest
> > snapshot build of build A ?
> >
> > This conversation seems to keep mixing up SNAPSHOT version processing
> > with various conventions for using version ranges.
> >
> > If the producer produces x.y.z-SNAPSHOT, and the consumer declares a
> > dependency on x.y.z-SNAPSHOT, every build of the consumer will go out
> > to the repositories to look for the latest snapshot build.
> >
> > Snapshots have risks and do not provide a repeatable build. Then
> > again, neither do ranges.
> >
> > If you don't want to use snapshots, then you write the dependency in
> > the consumer with a range
> >
> >     (1.0-2.0]
> >
> > or whatever makes sense. This will cause builds of the consumer to go
> > out to repositories and try to find the newest version within the
> > range. it's up to you to bump the version in the producer, manually or
> > with the maven-release-plugin.
> >
> >
> >
> >
> > >
> > > Scenario:
> > >
> > > Build A has 3 builds in it with names 1-Snapshot, 2-snapshot,
> 3-snapshot
> > and they are all being uploaded to a repository.
> > >
> > > What will the pom file in build B look like so that the next time build
> > B is executed,  3-snapshot for build A will be picked up ?
> > >
> > > -----Original Message-----
> > > From: Karl Heinz Marbaise [mailto:[hidden email]]
> > > Sent: Friday, April 7, 2017 10:50 AM
> > > To: Maven Users List <[hidden email]>
> > > Subject: Re: dependency question
> > >
> > > Hi Russlel,
> > > On 07/04/17 17:29, Russell Gold wrote:
> > >
> > >> That’s the way it works: when you specify a snapshot, it takes the
> > latest.
> > >
> > > This is not 100% true, cause it depends on the update policy you have
> > > defined in your settings either explicit or by default the updates will
> > > be checked every 24 hours...
> > >
> > > If you like to force this you can use mvn -U ...or define a different
> > > updatePolicy in your settings.xml for the appropriate repository.
> > >
> > > By using mvn -U you make sure for running this build Maven will check
> if
> > > there are newer SNAPSHOT version available for dependencies which have
> > > defined a SNAPSHOT version....
> > >
> > > This is working for a single module project...but if you have a multi
> > > module build (Project C: A1 build before A2) which takes for example 5
> > > minutes to build ...this is no longer 100% true...
> > >
> > > Now let us assume you have another project B which dependends on two
> > > different artifacts (A1, A2) of Project C ...this means in consequence
> > > those artifacts are build at two different times...
> > >
> > > This means it could happen that your build of Project B consumes A2
> from
> > > build #10 but A1 from build #9 ...
> > >
> > >
> > > In practical it usually works without any issue using the mvn -U ...but
> > > you should be aware of this issue...
> > >
> > >
> > > The only solution which I have found to make 100% sure is to use the
> > > output during the build of the project A and use those parsed
> > > informations about the SNAPSHOT versions and inject them into my
> current
> > > build ...(https://github.com/khmarbaise/deployment-recorder-extension
> > > not ready yet)...
> > >
> > > Kind regards
> > > Karl Heinz Marbaise
> > >
> > >
> > >>
> > >> There are some corner cases where it won’t. I think it only checks for
> > a new snapshot every few hours or so, so if you are putting out a lot you
> > might conceivably miss one. You can reset that if you need to
> > >> .
> > >>> On Apr 7, 2017, at 11:27 AM, Magnanao, Hector <
> [hidden email]>
> > wrote:
> > >>>
> > >>> If the builds for A are always getting a unique build number as a
> > snapshot build,  how am I sure that B will always get the latest snapshot
> > of A ?  Is there a way to name the A snapshot builds with a unique build
> > number each time for this scenario.
> > >>>
> > >>> -----Original Message-----
> > >>> From: Russell Gold [mailto:[hidden email]]
> > >>> Sent: Thursday, April 6, 2017 2:27 PM
> > >>> To: Maven Users List <[hidden email]>
> > >>> Subject: Re: dependency question
> > >>>
> > >>> The simplest way is simply to use a snapshot version of A. That way B
> > will always use the latest snapshot. When you finally release A, you can
> > have B point to the released version instead of the snapshot.
> > >>>
> > >>>> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <
> [hidden email]>
> > wrote:
> > >>>>
> > >>>> I have to 2 java projects a and b in maven.  The B project uses the
> A
> > build as a dependency.  How do I ensure the whenever the A project has a
> > new build,  the B project will always use that latest build in A.  A is
> > being built with a unique build number each time it gets built.  So is A
> > has build # 10 as the newest build,  the B project has to use build #10
> of
> > A.
> > >>>>
> > >>>>
> > >>>> Hector Magnanao Jr.
> > >>>> SCM Analyst
> > >>>> SAP Fieldglass
> > >>>> Skype:  (331) 702-6142
> > >>>> Mobile:  (847) 857-8401
> > >>>> Email: [hidden email]
> > >>>>
> > >>>
> > >>>
> > >
> > > ---------------------------------------------------------------------
> > > 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]
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
--
Sent from my phone
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: dependency question

Curtis Rueden
Hi Stephen,

> > There is a special version keyword LATEST which means the very newest
> > version, snapshot or otherwise. And RELEASE means the newest release
> > (non-SNAPSHOT) version.
>
> Support for those were dropped in Maven 3

By "support" do you mean "social support" as opposed to technical
functionality?

Because they are still present in the codebase, and they still work
technically:
   https://github.com/apache/maven/blob/master/maven-
resolver-provider/src/main/java/org/apache/maven/repository/internal/
DefaultVersionResolver.java#L188-L197

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden


On Tue, Apr 11, 2017 at 2:44 PM, Stephen Connolly <
[hidden email]> wrote:

> On Tue 11 Apr 2017 at 16:02, Curtis Rueden <[hidden email]> wrote:
>
> > Hi Hector,
> >
> > > This is fine as long as the dependency is always set to x.y.z-Snapshot
> > > and the dependency is always overwritten this way.  What if the
> > > producer produces x.y.z.1-Snapshot, x.y.z.2-Snapshot, x.y.z.3-Snapshot
> > > and I want the dependent build to always get the latest in this case,
> > > x.y.z.3-Snapshot ?
> >
> > There is a special version keyword LATEST which means the very newest
> > version, snapshot or otherwise. And RELEASE means the newest release
> > (non-SNAPSHOT) version.
>
>
> Support for those were dropped in Maven 3
>
> *and* anyway they were only for *plugin* versions because the plugin
> version does not support ranges.
>
> For dependency versions, define a range
>
> >
> >
> > Similar to version ranges, Maven will have to ask the remote repository
> > about the latest known version in these cases, and will then use that.
> >
> > I want to emphasize, as others have mentioned, that using any of these
> > strategies will result in _irreproducible builds_. That is, your code
> might
> > build today, and then the same code will fail to build in the future,
> > because the versions will resolve differently. The only way (I know of)
> to
> > achieve reproducible builds is to use fixed release versions, always.
> >
> > Regards,
> > Curtis
> >
> > --
> > Curtis Rueden
> > LOCI software architect - https://loci.wisc.edu/software
> > ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
> >
> >
> > On Tue, Apr 11, 2017 at 9:57 AM, Magnanao, Hector <
> [hidden email]
> > >
> > wrote:
> >
> > > This is fine as long as the dependency is always set to x.y.z-Snapshot
> > and
> > > the dependency is always overwritten this way.  What if the producer
> > > produces x.y.z.1-Snapshot, x.y.z.2-Snapshot, x.y.z.3-Snapshot and I
> want
> > > the dependent build to always get the latest in this case,
> > > x.y.z.3-Snapshot ? The difference with this scenario is that the
> producer
> > > will always have a new build number.
> > > As for your solution of using the range,  do I always have to change
> the
> > > pom file in the dependent build whenever a new build is produced by the
> > > producer ?
> > >
> > > -----Original Message-----
> > > From: Benson Margulies [mailto:[hidden email]]
> > > Sent: Monday, April 10, 2017 10:39 AM
> > > To: Maven Users List <[hidden email]>
> > > Subject: Re: dependency question
> > >
> > > On Mon, Apr 10, 2017 at 8:18 AM, Magnanao, Hector
> > > <[hidden email]> wrote:
> > > > I'm still a little confused about the answers I'm getting.  So, if
> > build
> > > A is being updated with a new build number(even for a snapshot), and
> > build
> > > B has it as a dependency in it's pom.file, how does the pom file in
> > Build B
> > > need to look like in the dependency section so that it does get the
> > latest
> > > snapshot build of build A ?
> > >
> > > This conversation seems to keep mixing up SNAPSHOT version processing
> > > with various conventions for using version ranges.
> > >
> > > If the producer produces x.y.z-SNAPSHOT, and the consumer declares a
> > > dependency on x.y.z-SNAPSHOT, every build of the consumer will go out
> > > to the repositories to look for the latest snapshot build.
> > >
> > > Snapshots have risks and do not provide a repeatable build. Then
> > > again, neither do ranges.
> > >
> > > If you don't want to use snapshots, then you write the dependency in
> > > the consumer with a range
> > >
> > >     (1.0-2.0]
> > >
> > > or whatever makes sense. This will cause builds of the consumer to go
> > > out to repositories and try to find the newest version within the
> > > range. it's up to you to bump the version in the producer, manually or
> > > with the maven-release-plugin.
> > >
> > >
> > >
> > >
> > > >
> > > > Scenario:
> > > >
> > > > Build A has 3 builds in it with names 1-Snapshot, 2-snapshot,
> > 3-snapshot
> > > and they are all being uploaded to a repository.
> > > >
> > > > What will the pom file in build B look like so that the next time
> build
> > > B is executed,  3-snapshot for build A will be picked up ?
> > > >
> > > > -----Original Message-----
> > > > From: Karl Heinz Marbaise [mailto:[hidden email]]
> > > > Sent: Friday, April 7, 2017 10:50 AM
> > > > To: Maven Users List <[hidden email]>
> > > > Subject: Re: dependency question
> > > >
> > > > Hi Russlel,
> > > > On 07/04/17 17:29, Russell Gold wrote:
> > > >
> > > >> That’s the way it works: when you specify a snapshot, it takes the
> > > latest.
> > > >
> > > > This is not 100% true, cause it depends on the update policy you have
> > > > defined in your settings either explicit or by default the updates
> will
> > > > be checked every 24 hours...
> > > >
> > > > If you like to force this you can use mvn -U ...or define a different
> > > > updatePolicy in your settings.xml for the appropriate repository.
> > > >
> > > > By using mvn -U you make sure for running this build Maven will check
> > if
> > > > there are newer SNAPSHOT version available for dependencies which
> have
> > > > defined a SNAPSHOT version....
> > > >
> > > > This is working for a single module project...but if you have a multi
> > > > module build (Project C: A1 build before A2) which takes for example
> 5
> > > > minutes to build ...this is no longer 100% true...
> > > >
> > > > Now let us assume you have another project B which dependends on two
> > > > different artifacts (A1, A2) of Project C ...this means in
> consequence
> > > > those artifacts are build at two different times...
> > > >
> > > > This means it could happen that your build of Project B consumes A2
> > from
> > > > build #10 but A1 from build #9 ...
> > > >
> > > >
> > > > In practical it usually works without any issue using the mvn -U
> ...but
> > > > you should be aware of this issue...
> > > >
> > > >
> > > > The only solution which I have found to make 100% sure is to use the
> > > > output during the build of the project A and use those parsed
> > > > informations about the SNAPSHOT versions and inject them into my
> > current
> > > > build ...(https://github.com/khmarbaise/deployment-recorder-
> extension
> > > > not ready yet)...
> > > >
> > > > Kind regards
> > > > Karl Heinz Marbaise
> > > >
> > > >
> > > >>
> > > >> There are some corner cases where it won’t. I think it only checks
> for
> > > a new snapshot every few hours or so, so if you are putting out a lot
> you
> > > might conceivably miss one. You can reset that if you need to
> > > >> .
> > > >>> On Apr 7, 2017, at 11:27 AM, Magnanao, Hector <
> > [hidden email]>
> > > wrote:
> > > >>>
> > > >>> If the builds for A are always getting a unique build number as a
> > > snapshot build,  how am I sure that B will always get the latest
> snapshot
> > > of A ?  Is there a way to name the A snapshot builds with a unique
> build
> > > number each time for this scenario.
> > > >>>
> > > >>> -----Original Message-----
> > > >>> From: Russell Gold [mailto:[hidden email]]
> > > >>> Sent: Thursday, April 6, 2017 2:27 PM
> > > >>> To: Maven Users List <[hidden email]>
> > > >>> Subject: Re: dependency question
> > > >>>
> > > >>> The simplest way is simply to use a snapshot version of A. That
> way B
> > > will always use the latest snapshot. When you finally release A, you
> can
> > > have B point to the released version instead of the snapshot.
> > > >>>
> > > >>>> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <
> > [hidden email]>
> > > wrote:
> > > >>>>
> > > >>>> I have to 2 java projects a and b in maven.  The B project uses
> the
> > A
> > > build as a dependency.  How do I ensure the whenever the A project has
> a
> > > new build,  the B project will always use that latest build in A.  A is
> > > being built with a unique build number each time it gets built.  So is
> A
> > > has build # 10 as the newest build,  the B project has to use build #10
> > of
> > > A.
> > > >>>>
> > > >>>>
> > > >>>> Hector Magnanao Jr.
> > > >>>> SCM Analyst
> > > >>>> SAP Fieldglass
> > > >>>> Skype:  (331) 702-6142
> > > >>>> Mobile:  (847) 857-8401
> > > >>>> Email: [hidden email]
> > > >>>>
> > > >>>
> > > >>>
> > > >
> > > > ------------------------------------------------------------
> ---------
> > > > 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]
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> >
> --
> Sent from my phone
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: dependency question

stephenconnolly
On Tue 11 Apr 2017 at 20:55, Curtis Rueden <[hidden email]> wrote:

> Hi Stephen,
>
> > > There is a special version keyword LATEST which means the very newest
> > > version, snapshot or otherwise. And RELEASE means the newest release
> > > (non-SNAPSHOT) version.
> >
> > Support for those were dropped in Maven 3
>
> By "support" do you mean "social support" as opposed to technical
> functionality?


They were supposed to be removed.

If they are working now, that's a bug


>
> Because they are still present in the codebase, and they still work
> technically:
>    https://github.com/apache/maven/blob/master/maven-
> resolver-provider/src/main/java/org/apache/maven/repository/internal/
> DefaultVersionResolver.java#L188-L197
>
> Regards,
> Curtis
>
> --
> Curtis Rueden
> LOCI software architect - https://loci.wisc.edu/software
> ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
>
>
> On Tue, Apr 11, 2017 at 2:44 PM, Stephen Connolly <
> [hidden email]> wrote:
>
> > On Tue 11 Apr 2017 at 16:02, Curtis Rueden <[hidden email]> wrote:
> >
> > > Hi Hector,
> > >
> > > > This is fine as long as the dependency is always set to
> x.y.z-Snapshot
> > > > and the dependency is always overwritten this way.  What if the
> > > > producer produces x.y.z.1-Snapshot, x.y.z.2-Snapshot,
> x.y.z.3-Snapshot
> > > > and I want the dependent build to always get the latest in this case,
> > > > x.y.z.3-Snapshot ?
> > >
> > > There is a special version keyword LATEST which means the very newest
> > > version, snapshot or otherwise. And RELEASE means the newest release
> > > (non-SNAPSHOT) version.
> >
> >
> > Support for those were dropped in Maven 3
> >
> > *and* anyway they were only for *plugin* versions because the plugin
> > version does not support ranges.
> >
> > For dependency versions, define a range
> >
> > >
> > >
> > > Similar to version ranges, Maven will have to ask the remote repository
> > > about the latest known version in these cases, and will then use that.
> > >
> > > I want to emphasize, as others have mentioned, that using any of these
> > > strategies will result in _irreproducible builds_. That is, your code
> > might
> > > build today, and then the same code will fail to build in the future,
> > > because the versions will resolve differently. The only way (I know of)
> > to
> > > achieve reproducible builds is to use fixed release versions, always.
> > >
> > > Regards,
> > > Curtis
> > >
> > > --
> > > Curtis Rueden
> > > LOCI software architect - https://loci.wisc.edu/software
> > > ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
> > >
> > >
> > > On Tue, Apr 11, 2017 at 9:57 AM, Magnanao, Hector <
> > [hidden email]
> > > >
> > > wrote:
> > >
> > > > This is fine as long as the dependency is always set to
> x.y.z-Snapshot
> > > and
> > > > the dependency is always overwritten this way.  What if the producer
> > > > produces x.y.z.1-Snapshot, x.y.z.2-Snapshot, x.y.z.3-Snapshot and I
> > want
> > > > the dependent build to always get the latest in this case,
> > > > x.y.z.3-Snapshot ? The difference with this scenario is that the
> > producer
> > > > will always have a new build number.
> > > > As for your solution of using the range,  do I always have to change
> > the
> > > > pom file in the dependent build whenever a new build is produced by
> the
> > > > producer ?
> > > >
> > > > -----Original Message-----
> > > > From: Benson Margulies [mailto:[hidden email]]
> > > > Sent: Monday, April 10, 2017 10:39 AM
> > > > To: Maven Users List <[hidden email]>
> > > > Subject: Re: dependency question
> > > >
> > > > On Mon, Apr 10, 2017 at 8:18 AM, Magnanao, Hector
> > > > <[hidden email]> wrote:
> > > > > I'm still a little confused about the answers I'm getting.  So, if
> > > build
> > > > A is being updated with a new build number(even for a snapshot), and
> > > build
> > > > B has it as a dependency in it's pom.file, how does the pom file in
> > > Build B
> > > > need to look like in the dependency section so that it does get the
> > > latest
> > > > snapshot build of build A ?
> > > >
> > > > This conversation seems to keep mixing up SNAPSHOT version processing
> > > > with various conventions for using version ranges.
> > > >
> > > > If the producer produces x.y.z-SNAPSHOT, and the consumer declares a
> > > > dependency on x.y.z-SNAPSHOT, every build of the consumer will go out
> > > > to the repositories to look for the latest snapshot build.
> > > >
> > > > Snapshots have risks and do not provide a repeatable build. Then
> > > > again, neither do ranges.
> > > >
> > > > If you don't want to use snapshots, then you write the dependency in
> > > > the consumer with a range
> > > >
> > > >     (1.0-2.0]
> > > >
> > > > or whatever makes sense. This will cause builds of the consumer to go
> > > > out to repositories and try to find the newest version within the
> > > > range. it's up to you to bump the version in the producer, manually
> or
> > > > with the maven-release-plugin.
> > > >
> > > >
> > > >
> > > >
> > > > >
> > > > > Scenario:
> > > > >
> > > > > Build A has 3 builds in it with names 1-Snapshot, 2-snapshot,
> > > 3-snapshot
> > > > and they are all being uploaded to a repository.
> > > > >
> > > > > What will the pom file in build B look like so that the next time
> > build
> > > > B is executed,  3-snapshot for build A will be picked up ?
> > > > >
> > > > > -----Original Message-----
> > > > > From: Karl Heinz Marbaise [mailto:[hidden email]]
> > > > > Sent: Friday, April 7, 2017 10:50 AM
> > > > > To: Maven Users List <[hidden email]>
> > > > > Subject: Re: dependency question
> > > > >
> > > > > Hi Russlel,
> > > > > On 07/04/17 17:29, Russell Gold wrote:
> > > > >
> > > > >> That’s the way it works: when you specify a snapshot, it takes the
> > > > latest.
> > > > >
> > > > > This is not 100% true, cause it depends on the update policy you
> have
> > > > > defined in your settings either explicit or by default the updates
> > will
> > > > > be checked every 24 hours...
> > > > >
> > > > > If you like to force this you can use mvn -U ...or define a
> different
> > > > > updatePolicy in your settings.xml for the appropriate repository.
> > > > >
> > > > > By using mvn -U you make sure for running this build Maven will
> check
> > > if
> > > > > there are newer SNAPSHOT version available for dependencies which
> > have
> > > > > defined a SNAPSHOT version....
> > > > >
> > > > > This is working for a single module project...but if you have a
> multi
> > > > > module build (Project C: A1 build before A2) which takes for
> example
> > 5
> > > > > minutes to build ...this is no longer 100% true...
> > > > >
> > > > > Now let us assume you have another project B which dependends on
> two
> > > > > different artifacts (A1, A2) of Project C ...this means in
> > consequence
> > > > > those artifacts are build at two different times...
> > > > >
> > > > > This means it could happen that your build of Project B consumes A2
> > > from
> > > > > build #10 but A1 from build #9 ...
> > > > >
> > > > >
> > > > > In practical it usually works without any issue using the mvn -U
> > ...but
> > > > > you should be aware of this issue...
> > > > >
> > > > >
> > > > > The only solution which I have found to make 100% sure is to use
> the
> > > > > output during the build of the project A and use those parsed
> > > > > informations about the SNAPSHOT versions and inject them into my
> > > current
> > > > > build ...(https://github.com/khmarbaise/deployment-recorder-
> > extension
> > > > > not ready yet)...
> > > > >
> > > > > Kind regards
> > > > > Karl Heinz Marbaise
> > > > >
> > > > >
> > > > >>
> > > > >> There are some corner cases where it won’t. I think it only checks
> > for
> > > > a new snapshot every few hours or so, so if you are putting out a lot
> > you
> > > > might conceivably miss one. You can reset that if you need to
> > > > >> .
> > > > >>> On Apr 7, 2017, at 11:27 AM, Magnanao, Hector <
> > > [hidden email]>
> > > > wrote:
> > > > >>>
> > > > >>> If the builds for A are always getting a unique build number as a
> > > > snapshot build,  how am I sure that B will always get the latest
> > snapshot
> > > > of A ?  Is there a way to name the A snapshot builds with a unique
> > build
> > > > number each time for this scenario.
> > > > >>>
> > > > >>> -----Original Message-----
> > > > >>> From: Russell Gold [mailto:[hidden email]]
> > > > >>> Sent: Thursday, April 6, 2017 2:27 PM
> > > > >>> To: Maven Users List <[hidden email]>
> > > > >>> Subject: Re: dependency question
> > > > >>>
> > > > >>> The simplest way is simply to use a snapshot version of A. That
> > way B
> > > > will always use the latest snapshot. When you finally release A, you
> > can
> > > > have B point to the released version instead of the snapshot.
> > > > >>>
> > > > >>>> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <
> > > [hidden email]>
> > > > wrote:
> > > > >>>>
> > > > >>>> I have to 2 java projects a and b in maven.  The B project uses
> > the
> > > A
> > > > build as a dependency.  How do I ensure the whenever the A project
> has
> > a
> > > > new build,  the B project will always use that latest build in A.  A
> is
> > > > being built with a unique build number each time it gets built.  So
> is
> > A
> > > > has build # 10 as the newest build,  the B project has to use build
> #10
> > > of
> > > > A.
> > > > >>>>
> > > > >>>>
> > > > >>>> Hector Magnanao Jr.
> > > > >>>> SCM Analyst
> > > > >>>> SAP Fieldglass
> > > > >>>> Skype:  (331) 702-6142
> > > > >>>> Mobile:  (847) 857-8401
> > > > >>>> Email: [hidden email]
> > > > >>>>
> > > > >>>
> > > > >>>
> > > > >
> > > > > ------------------------------------------------------------
> > ---------
> > > > > 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]
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [hidden email]
> > > > For additional commands, e-mail: [hidden email]
> > > >
> > >
> > --
> > Sent from my phone
> >
>
--
Sent from my phone
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: dependency question

Karl Heinz Marbaise-3
Hi,


On 11/04/17 23:38, Stephen Connolly wrote:

> On Tue 11 Apr 2017 at 20:55, Curtis Rueden <[hidden email]> wrote:
>
>> Hi Stephen,
>>
>>>> There is a special version keyword LATEST which means the very newest
>>>> version, snapshot or otherwise. And RELEASE means the newest release
>>>> (non-SNAPSHOT) version.
>>>
>>> Support for those were dropped in Maven 3
>>
>> By "support" do you mean "social support" as opposed to technical
>> functionality?
>
>
> They were supposed to be removed.
>
> If they are working now, that's a bug

Unfortunately they are working ;-(..

https://issues.apache.org/jira/browse/MNG-6206

Kind regards
Karl Heinz Marbaise

>
>
>>
>> Because they are still present in the codebase, and they still work
>> technically:
>>    https://github.com/apache/maven/blob/master/maven-
>> resolver-provider/src/main/java/org/apache/maven/repository/internal/
>> DefaultVersionResolver.java#L188-L197
>>
>> Regards,
>> Curtis
>>
>> --
>> Curtis Rueden
>> LOCI software architect - https://loci.wisc.edu/software
>> ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
>>
>>
>> On Tue, Apr 11, 2017 at 2:44 PM, Stephen Connolly <
>> [hidden email]> wrote:
>>
>>> On Tue 11 Apr 2017 at 16:02, Curtis Rueden <[hidden email]> wrote:
>>>
>>>> Hi Hector,
>>>>
>>>>> This is fine as long as the dependency is always set to
>> x.y.z-Snapshot
>>>>> and the dependency is always overwritten this way.  What if the
>>>>> producer produces x.y.z.1-Snapshot, x.y.z.2-Snapshot,
>> x.y.z.3-Snapshot
>>>>> and I want the dependent build to always get the latest in this case,
>>>>> x.y.z.3-Snapshot ?
>>>>
>>>> There is a special version keyword LATEST which means the very newest
>>>> version, snapshot or otherwise. And RELEASE means the newest release
>>>> (non-SNAPSHOT) version.
>>>
>>>
>>> Support for those were dropped in Maven 3
>>>
>>> *and* anyway they were only for *plugin* versions because the plugin
>>> version does not support ranges.
>>>
>>> For dependency versions, define a range
>>>
>>>>
>>>>
>>>> Similar to version ranges, Maven will have to ask the remote repository
>>>> about the latest known version in these cases, and will then use that.
>>>>
>>>> I want to emphasize, as others have mentioned, that using any of these
>>>> strategies will result in _irreproducible builds_. That is, your code
>>> might
>>>> build today, and then the same code will fail to build in the future,
>>>> because the versions will resolve differently. The only way (I know of)
>>> to
>>>> achieve reproducible builds is to use fixed release versions, always.
>>>>
>>>> Regards,
>>>> Curtis
>>>>
>>>> --
>>>> Curtis Rueden
>>>> LOCI software architect - https://loci.wisc.edu/software
>>>> ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
>>>>
>>>>
>>>> On Tue, Apr 11, 2017 at 9:57 AM, Magnanao, Hector <
>>> [hidden email]
>>>>>
>>>> wrote:
>>>>
>>>>> This is fine as long as the dependency is always set to
>> x.y.z-Snapshot
>>>> and
>>>>> the dependency is always overwritten this way.  What if the producer
>>>>> produces x.y.z.1-Snapshot, x.y.z.2-Snapshot, x.y.z.3-Snapshot and I
>>> want
>>>>> the dependent build to always get the latest in this case,
>>>>> x.y.z.3-Snapshot ? The difference with this scenario is that the
>>> producer
>>>>> will always have a new build number.
>>>>> As for your solution of using the range,  do I always have to change
>>> the
>>>>> pom file in the dependent build whenever a new build is produced by
>> the
>>>>> producer ?
>>>>>
>>>>> -----Original Message-----
>>>>> From: Benson Margulies [mailto:[hidden email]]
>>>>> Sent: Monday, April 10, 2017 10:39 AM
>>>>> To: Maven Users List <[hidden email]>
>>>>> Subject: Re: dependency question
>>>>>
>>>>> On Mon, Apr 10, 2017 at 8:18 AM, Magnanao, Hector
>>>>> <[hidden email]> wrote:
>>>>>> I'm still a little confused about the answers I'm getting.  So, if
>>>> build
>>>>> A is being updated with a new build number(even for a snapshot), and
>>>> build
>>>>> B has it as a dependency in it's pom.file, how does the pom file in
>>>> Build B
>>>>> need to look like in the dependency section so that it does get the
>>>> latest
>>>>> snapshot build of build A ?
>>>>>
>>>>> This conversation seems to keep mixing up SNAPSHOT version processing
>>>>> with various conventions for using version ranges.
>>>>>
>>>>> If the producer produces x.y.z-SNAPSHOT, and the consumer declares a
>>>>> dependency on x.y.z-SNAPSHOT, every build of the consumer will go out
>>>>> to the repositories to look for the latest snapshot build.
>>>>>
>>>>> Snapshots have risks and do not provide a repeatable build. Then
>>>>> again, neither do ranges.
>>>>>
>>>>> If you don't want to use snapshots, then you write the dependency in
>>>>> the consumer with a range
>>>>>
>>>>>     (1.0-2.0]
>>>>>
>>>>> or whatever makes sense. This will cause builds of the consumer to go
>>>>> out to repositories and try to find the newest version within the
>>>>> range. it's up to you to bump the version in the producer, manually
>> or
>>>>> with the maven-release-plugin.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>> Scenario:
>>>>>>
>>>>>> Build A has 3 builds in it with names 1-Snapshot, 2-snapshot,
>>>> 3-snapshot
>>>>> and they are all being uploaded to a repository.
>>>>>>
>>>>>> What will the pom file in build B look like so that the next time
>>> build
>>>>> B is executed,  3-snapshot for build A will be picked up ?
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Karl Heinz Marbaise [mailto:[hidden email]]
>>>>>> Sent: Friday, April 7, 2017 10:50 AM
>>>>>> To: Maven Users List <[hidden email]>
>>>>>> Subject: Re: dependency question
>>>>>>
>>>>>> Hi Russlel,
>>>>>> On 07/04/17 17:29, Russell Gold wrote:
>>>>>>
>>>>>>> That’s the way it works: when you specify a snapshot, it takes the
>>>>> latest.
>>>>>>
>>>>>> This is not 100% true, cause it depends on the update policy you
>> have
>>>>>> defined in your settings either explicit or by default the updates
>>> will
>>>>>> be checked every 24 hours...
>>>>>>
>>>>>> If you like to force this you can use mvn -U ...or define a
>> different
>>>>>> updatePolicy in your settings.xml for the appropriate repository.
>>>>>>
>>>>>> By using mvn -U you make sure for running this build Maven will
>> check
>>>> if
>>>>>> there are newer SNAPSHOT version available for dependencies which
>>> have
>>>>>> defined a SNAPSHOT version....
>>>>>>
>>>>>> This is working for a single module project...but if you have a
>> multi
>>>>>> module build (Project C: A1 build before A2) which takes for
>> example
>>> 5
>>>>>> minutes to build ...this is no longer 100% true...
>>>>>>
>>>>>> Now let us assume you have another project B which dependends on
>> two
>>>>>> different artifacts (A1, A2) of Project C ...this means in
>>> consequence
>>>>>> those artifacts are build at two different times...
>>>>>>
>>>>>> This means it could happen that your build of Project B consumes A2
>>>> from
>>>>>> build #10 but A1 from build #9 ...
>>>>>>
>>>>>>
>>>>>> In practical it usually works without any issue using the mvn -U
>>> ...but
>>>>>> you should be aware of this issue...
>>>>>>
>>>>>>
>>>>>> The only solution which I have found to make 100% sure is to use
>> the
>>>>>> output during the build of the project A and use those parsed
>>>>>> informations about the SNAPSHOT versions and inject them into my
>>>> current
>>>>>> build ...(https://github.com/khmarbaise/deployment-recorder-
>>> extension
>>>>>> not ready yet)...
>>>>>>
>>>>>> Kind regards
>>>>>> Karl Heinz Marbaise
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> There are some corner cases where it won’t. I think it only checks
>>> for
>>>>> a new snapshot every few hours or so, so if you are putting out a lot
>>> you
>>>>> might conceivably miss one. You can reset that if you need to
>>>>>>> .
>>>>>>>> On Apr 7, 2017, at 11:27 AM, Magnanao, Hector <
>>>> [hidden email]>
>>>>> wrote:
>>>>>>>>
>>>>>>>> If the builds for A are always getting a unique build number as a
>>>>> snapshot build,  how am I sure that B will always get the latest
>>> snapshot
>>>>> of A ?  Is there a way to name the A snapshot builds with a unique
>>> build
>>>>> number each time for this scenario.
>>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Russell Gold [mailto:[hidden email]]
>>>>>>>> Sent: Thursday, April 6, 2017 2:27 PM
>>>>>>>> To: Maven Users List <[hidden email]>
>>>>>>>> Subject: Re: dependency question
>>>>>>>>
>>>>>>>> The simplest way is simply to use a snapshot version of A. That
>>> way B
>>>>> will always use the latest snapshot. When you finally release A, you
>>> can
>>>>> have B point to the released version instead of the snapshot.
>>>>>>>>
>>>>>>>>> On Apr 6, 2017, at 2:52 PM, Magnanao, Hector <
>>>> [hidden email]>
>>>>> wrote:
>>>>>>>>>
>>>>>>>>> I have to 2 java projects a and b in maven.  The B project uses
>>> the
>>>> A
>>>>> build as a dependency.  How do I ensure the whenever the A project
>> has
>>> a
>>>>> new build,  the B project will always use that latest build in A.  A
>> is
>>>>> being built with a unique build number each time it gets built.  So
>> is
>>> A
>>>>> has build # 10 as the newest build,  the B project has to use build
>> #10
>>>> of
>>>>> A.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Hector Magnanao Jr.
>>>>>>>>> SCM Analyst
>>>>>>>>> SAP Fieldglass
>>>>>>>>> Skype:  (331) 702-6142
>>>>>>>>> Mobile:  (847) 857-8401
>>>>>>>>> Email: [hidden email]
>>>>>>>>>
>>>>>>>>
>>>>>>>>

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

Loading...