Hi Doug,

I had a lot of problems with build number and M2 compat resolvers.  I
eventually changed our 'publish' repo to be Ivy instead of M2 compat
so that the build numbers work and then do a second publish to an
enterprise repo which is M2 compat so that everything looks the same
from the users perspective.

Even using an Ivy repo the build number is not perfect and I
ocassionally have to override it in the build script (e.g., starting
and ending an RC series).

If you read the docs carefully there are several Ivy features that
don't play well with M2 - it would be useful to document them more
clearly (to many things to do...).

There are more details of the problems I had in the mailing lists.

Cheers,
Geoff

On Fri, Jul 31, 2009 at 6:15 AM, Glidden, Douglass
A<[email protected]> wrote:
> Hi,
>
> I've run into some weird behavior when the ivy buildnumber task is used with 
> a url resolver more than once in the same build.  Here's a sample scenario:
>
> Included in my resolvers are a releases resolver and a snapshots resolver, 
> which run against two repositories in the same Nexus repository manager.  The 
> snapshot revision number is based on the current release revision number, 
> e.g. if the latest revision in the releases repository is 0.6 then any new 
> snapshots created should be 0.7-SNAPSHOT-# (where # is incremented with each 
> new snapshot created).  My build then first runs ivy:buildnumber against the 
> releases resolver, then uses the result of that in running ivy:buildnumber 
> against the snapshots resolver.  The problem is that ivy:buildnumber doesn't 
> construct the URL correctly when it is re-run.  Here are relevant excerpts 
> from the debug output:
>
> When ivy:buildnumber is run against the releases resolver, then against the 
> snapshots resolver:
> ...
> [ivy:buildnumber]       using releases to list all in 
> http://nexus.myorg.com:8081/nexus/content/repositories/releases/myorg/myproject/
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/releases/myorg/myproject/0.6/].
> [ivy:buildnumber]               found 1 resources
> [ivy:buildnumber]       using releases to list all in 
> http://nexus.myorg.com:8081/nexus/content/repositories/releases/myorg/myproject/
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/releases/myorg/myproject/0.6/].
> [ivy:buildnumber]               found 1 resources
> [ivy:buildnumber]       using releases to list all in 
> http://nexus.myorg.com:8081/nexus/content/repositories/releases/myorg/myproject/0.6
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/releases/myorg/myproject/0.6/ivy-0.6.xml].
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/releases/myorg/myproject/0.6/ivy-0.6.xml.md5].
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/releases/myorg/myproject/0.6/ivy-0.6.xml.sha1].
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/releases/myorg/myproject/0.6/myproject-0.6.jar].
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/releases/myorg/myproject/0.6/myproject-0.6.jar.md5].
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/releases/myorg/myproject/0.6/myproject-0.6.jar.sha1].
> [ivy:buildnumber]               found 6 urls
> [ivy:buildnumber]               1 matched 
> http://nexus.myorg.com:8081/nexus/content/repositories/releases/myorg/myproject/0.6/[artifact]-0.6.jar
> ...
> [ivy:buildnumber]       using snapshots to list all in 
> http://nexus.myorg.myorg:8081/nexus/content/repositories/snapshots/
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.myorg:8081/nexus/content/repositories/snapshots/.meta/].
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.myorg:8081/nexus/content/repositories/snapshots/myorg/].
> [ivy:buildnumber]               found 2 resources
> [ivy:buildnumber]       using snapshots to list all in 
> http://nexus.myorg.myorg:8081/nexus/content/repositories/snapshots/
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.myorg:8081/nexus/content/repositories/snapshots/.meta/].
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.myorg:8081/nexus/content/repositories/snapshots/myorg/].
> [ivy:buildnumber]               found 2 resources
> ...
>
> As you can see, when it runs against the snapshots resolver, it leaves off 
> the organisation and module tokens from the URL.  The problem is not with the 
> settings for the snapshots resolver, though, because when ivy:buildnumber is 
> run against the snapshots resolver without first running it against the 
> releases resolver, the output is normal:
> ...
> [ivy:buildnumber]       using snapshots to list all in 
> http://nexus.myorg.com:8081/nexus/content/repositories/snapshots/myorg/myproject/
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/snapshots/myorg/myproject/0.7-SNAPSHOT-1/].
> [ivy:buildnumber]               found 1 resources
> [ivy:buildnumber]       using snapshots to list all in 
> http://nexus.myorg.com:8081/nexus/content/repositories/snapshots/myorg/myproject/
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/snapshots/myorg/myproject/0.7-SNAPSHOT-1/].
> [ivy:buildnumber]               found 1 resources
> [ivy:buildnumber]       using snapshots to list all in 
> http://nexus.myorg.com:8081/nexus/content/repositories/snapshots/myorg/myproject/0.7-SNAPSHOT-1
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/snapshots/myorg/myproject/0.7-SNAPSHOT-1/ivy-0.7-SNAPSHOT-1.xml].
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/snapshots/myorg/myproject/0.7-SNAPSHOT-1/ivy-0.7-SNAPSHOT-1.xml.md5].
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/snapshots/myorg/myproject/0.7-SNAPSHOT-1/ivy-0.7-SNAPSHOT-1.xml.sha1].
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/snapshots/myorg/myproject/0.7-SNAPSHOT-1/myproject-0.7-SNAPSHOT-1.jar].
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/snapshots/myorg/myproject/0.7-SNAPSHOT-1/myproject-0.7-SNAPSHOT-1.jar.md5].
> [ivy:buildnumber] ApacheURLLister found 
> URL=[http://nexus.myorg.com:8081/nexus/content/repositories/snapshots/myorg/myproject/0.7-SNAPSHOT-1/myproject-0.7-SNAPSHOT-1.jar.sha1].
> [ivy:buildnumber]               found 6 urls
> [ivy:buildnumber]               1 matched 
> http://nexus.myorg.com:8081/nexus/content/repositories/snapshots/myorg/myproject/0.7-SNAPSHOT-1/[artifact]-0.7-SNAPSHOT-1.jar
> ...
>
> Relevant portions from the properties and ivysettings files:
> ...
> ivy.nexus.default.artifact.pattern=[organisation]/[module]/[revision]/[artifact]-[revision].[ext]
> ivy.nexus.default.ivy.pattern=[organisation]/[module]/[revision]/ivy-[revision].xml
> ivy.nexus.repositories.path=content/repositories
> ivy.nexus.releases.path=${ivy.nexus.repositories.path}/releases
> ivy.nexus.snapshots.path=${ivy.nexus.repositories.path}/snapshots
> ivy.nexus.url=http://nexus.myorg.com:8081/nexus
> ...
>
> ...
> <url name="releases" m2compatible="true">
>  <ivy 
> pattern="${ivy.nexus.url}/${ivy.nexus.releases.path}/${ivy.nexus.default.ivy.pattern}"
>  />
>  <artifact 
> pattern="${ivy.nexus.url}/${ivy.nexus.releases.path}/${ivy.nexus.default.artifact.pattern}"
>  />
> </url>
> <url name="snapshots" m2compatible="true">
>  <ivy 
> pattern="${ivy.nexus.url}/${ivy.nexus.snapshots.path}/${ivy.nexus.default.ivy.pattern}"
>  />
>  <artifact 
> pattern="${ivy.nexus.url}/${ivy.nexus.snapshots.path}/${ivy.nexus.default.artifact.pattern}"
>  />
> </url>
> ...
>
> The build file has two trivial targets; one calls ivy:buildnumber against the 
> releases resolver and the other calls it against the snapshots resolver.  
> Either target produces correct results when it is run by itself, but when 
> both targets are run (regardless of order), the second one to be run always 
> shows the behavior described above.
>
> Is this a bug or am I doing something wrong here?
>
> Thanks,
>
> Doug Glidden
> Software Engineer
> The Boeing Company
> [email protected]
>
>
>

Reply via email to