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:khmarba...@gmx.de] Sent: Friday, April 7, 2017 10:50 AM To: Maven Users List <users@maven.apache.org> 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 <hector.magna...@sap.com> >> 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:russell.g...@oracle.com] >> Sent: Thursday, April 6, 2017 2:27 PM >> To: Maven Users List <users@maven.apache.org> >> 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 <hector.magna...@sap.com> >>> 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: hector.magna...@sap.com >>> >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org