You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Matt Walsh <mw...@chartwelltechnology.com> on 2012/02/24 00:35:00 UTC

Weirdities and wonders of the maven-metadata.xml file

Hi.

 

Sorry if this is a bit wordy, but I'm confused about how the metadata
file gets updated and downloaded to my local .m2/repository, and the
following describes what I've gone through to try to understand the
problem. I'm not sure if this is a Nexus issue or a Maven issue, so I
thought I'd start with the experts.

 

We just today released a 2.7 version of a project, let's call it
ProjectA, and deployed it to Nexus.

 

I have an archetype that generates another project that's dependent on,
say, version 2.5 of ProjectA. As the final step of creating a new
project from the archetype, it runs the versions:use-lastest-versions.
(I've also tried use-latest-releases with the same results noted below)
to update some dependencies, including ProjectA, to the latest released
version.

 

So I expected when I generated my new project, it would  update the
dependency to version 2.7. However, it only updated it to 2.6. After
some head-scratching, I checked the maven-metadata.xml file in Nexus. It
showed all my deployed versions, with latest=2.6 and release=2.7. So I
figured I was getting the latest instead of the release (hence, the
attempt at 'use-latest-releases' above.)

 

I logged into Nexus and ran Rebuild Metadata. Now, latest=2.7 and
release=2.7. Why wouldn't latest have been updated when 2.7 was added?
Makes no sense. 2.6 was deployed 2 weeks ago.

 

Anyway, with the rebuilt metadata in Nexus, I figured a run of my
archetype would be good, and it would update the dependency to 2.7. No
such luck; still only 2.6. So I tried it again with the -U option. Maven
downloaded the metadata for several plugins, but no other updates. Still
no luck. Checked my local repository, and the metadata in there is old.
I have 3 metadata files:

  maven-metadata-cwh.xml (cwh is the repositoryId of my release
repository, so I assume this comes from there).  It shows latest=2.4 and
release=2.5. 

  maven-metadata-local.xml shows release of 2.5; no latest.

  maven-metadata-nexus.xml shows release of 2.5 and latest of
3.0-SNAPSHOT, and has  versions up through 2.6, 2.7-SNAPSHOT, and
3.0-SNAPSHOT.

 

BTW, the 2.7 release of ProjectA was not performed by me, so there's no
sign of it in my local repository yet. 

 

So I built another project that's dependent on version 2.7 of ProjectA,
thus forcing a download of 2.7 to my local repository. All good.

Reran my archetype and still only updating to 2.6. No change to any of
the local metadata files.

 

So I blew away the ProjectA folder  from my local repository. Reran my
archetype, and voila! Updated dependency version to 2.7. ProjectA folder
in local repository now contains only one metadata file - the nexus one,
which has a latest=3.0-SNAPSHOT and a release=2.7.

 

So, why doesn't the latest version of the metadata get downloaded in a
timely fashion? How do I force it to download, other than by flushing it
from my local?

 

I find it somewhat disconcerting that I can't rely on retrieving the
latest information from the remote repository. And even worse, that I
have to flush my local repository to get updates.

 

Has anyone else encountered this issue?

 

Thanks,
Matt


______________________________________________________________________
This message, including any attachments, is confidential and contains information intended only for the person(s) named above. Any other distribution, copying or disclosure is strictly prohibited. If you are not the intended recipient or have received this message in error, please notify us immediately by reply email and permanently delete the original transmission from all of your systems and hard drives, including any attachments, without making a copy.