You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Laird Nelson <lj...@gmail.com> on 2012/08/24 22:31:46 UTC

Maven/Nexus metadata interaction question

I fear this is a stupid question, but I can't find any information anywhere
about Maven metadata.  :-(

I have the world's simplest Jenkins/Maven/Nexus setup.

I have a job on Jenkins that (today only, never before) began failing
because it claims it cannot resolve various SNAPSHOT artifacts from Nexus.
 It is effectively invoking mvn -U clean install on an ear project, which
(of course, as you'd expect) has various runtime dependencies.

The various errors look like this:

Caused by: org.apache.maven.model.resolution.UnresolvableModelException:
Could not find artifact com.foobar.pomtype-api:pom:1.009-SNAPSHOT


But the pomtype-api/1.009-SNAPSHOT directory is of course present, in
the very repository that Maven itself simultaneously documents as the
place it's looking and the place that theoretically does not contain
the artifact.  It is chock full of timestamped snapshots, each of
which has a .pom extension, and each of which was uploaded
successfully by a previous Jenkins job.


I have run across this issue various times over the years and have
always chalked it up to black magic.  Some combination of poking and
prodding and redoing and waiting and -U etc. always seems to clear the
mud out of the mechanism.  Not this time, and I'm tired of not
understanding how this all works.


Guessing in the dark, I'm assuming that Maven is somehow not able to
figure out how to turn "1.009-SNAPSHOT" into, e.g.,
"1.009-20120621.124828-107" and thus concludes that there is no
1.009-SNAPSHOT artifact at all.  Equally in the dark, I'm presuming
this has something to do with the (undocumented?) maven-metadata.xml
file, which doesn't seem to contain any useful information:


<metadata modelVersion="1.1.0">
<groupId>com.foobar</groupId>
<artifactId>pomtype-api</artifactId>
<version>1.009-SNAPSHOT</version>
<versioning>
<snapshot>
<timestamp>20120809.231215</timestamp>
<buildNumber>116</buildNumber>
</snapshot>
<lastUpdated>20120809231215</lastUpdated>
<snapshotVersions>
<snapshotVersion>
<extension>pom</extension>
<value>1.009-20120809.231215-116</value>
<updated>20120809231215</updated>
</snapshotVersion>
<snapshotVersion>
<classifier>tests</classifier>
<extension>jar</extension>
<value>1.009-20120809.231215-116</value>
<updated>20120809231215</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
</metadata>


I don't see how Maven could conclude much from this, but this seems to
be what it consults as part of its resolving snapshots; I can see this
being downloaded in the logs.


When Maven heads off to resolve 1.009-SNAPSHOT to a timestamped
version, how does it do it?  Why doesn't--in this case--it pick the
"most recent" snapshot, and what would cause it to do so?


Let's pretend just for kicks that redeploying a new snapshot is not a
possibility (the answer SURELY can't be to redeploy a new snapshot to
somehow cause the magic to happen).  What steps should I take?  Where
do I start looking to resolve this issue?


Thanks,

Laird


-- 
http://about.me/lairdnelson

Re: Maven/Nexus metadata interaction question

Posted by Laird Nelson <lj...@gmail.com>.
On Fri, Aug 24, 2012 at 1:31 PM, Laird Nelson <lj...@gmail.com> wrote:

> I fear this is a stupid question, but I can't find any information
> anywhere about Maven metadata.  :-(


Always like to correct myself when I say something that isn't true.  It
turns out there is some documentation on the maven-metadata.xml file
format:
http://maven.apache.org/ref/3.0.4/maven-repository-metadata/repository-metadata.html

However this documentation does not seem to explain why it is or how it
could be (is it legal?) that none of my maven-metadata.xml files present in
my Nexus repository feature the <latest> tag, which I would think (for
SNAPSHOTs) would be critical to resolving 1.009-SNAPSHOT into a timestamped
version.

Best,
Laird

-- 
http://about.me/lairdnelson

Re: Maven/Nexus metadata interaction question

Posted by David Hoffer <dh...@gmail.com>.
Now that I think about this...I think the metadata file that was
confusing IntelliJ might have been a different one, i.e. w/o Nexus in
the name.  I can't be sure since I have since deleted my local repo to
try to solve this problem.  I know there was a metadata file in that
folder that just had the build/timestamp info which pointed to
artifacts that do not exist and when I deleted it...IntelliJ changed
to referencing the plain snapshot file (e.g. no timestamp in file
name) which is what I want.

-Dave

On Fri, Aug 24, 2012 at 4:01 PM, David Hoffer <dh...@gmail.com> wrote:
> There are several metadata files...the one I was referring to is
> maven-metadata-nexus.xml.  Yeah I don't know for sure who generated
> this Maven/Nexus...I just assumed Nexus because of the file name.
>
> Yes in our builds we will sometimes run lesser important builds once a
> day, or at night, javadocs is a good example.  Javadoc generation adds
> considerably to the build time and doesn't have high value to be
> generated with each build because they don't change that often...and
> to be honest devs don't put much in javadocs anyway.
>
> This worked fine with Maven2...since Maven2 just generated simple
> snapshot jars it just overwrote the last one (which is what we want).
> Now with Maven3/Nexus this is broke.
>
> -Dave
>
> On Fri, Aug 24, 2012 at 3:49 PM, Brian Fox <br...@infinity.nu> wrote:
>> On Fri, Aug 24, 2012 at 5:43 PM, David Hoffer <dh...@gmail.com> wrote:
>>> I can't say the whole problem is with Nexus.  I can say that the
>>> requirement in Maven3 to always use timestamped snapshots has not be
>>> addressed in a complete way with tools like Nexus and my beloved IDE
>>> IntelliJ.  We have hundreds if not thousands of builds happening every
>>> day and they should be able to generate artifacts with various
>>> classifiers, i.e. sources.jar and javadoc.jar, etc.  But they don't
>>> all have to generate all of these classifiers with each build.  I
>>> might want to generate javadocs just at night because the build takes
>>> too long, etc.  Well this completely breaks Nexus and IntelliJ because
>>> Nexus will spit out a metadata file that says that the last
>>> timestamped build is, lets say 45, well that might be true for one of
>>> the artifacts, lets say it was javadocs, but 45 does not yet have
>>> sources or the main jar artifact (the latest for those is 44).
>>> However since Nexus advertised that build 45 is the latest, all the
>>> tools, i.e. IntelliJ go looking for artifacts for that build number
>>> and they do not exist.  So the only workaround for that is that all
>>> builds must include all classifiers...can't do just the one we
>>> need/want.
>>
>> This is an interesting use case, so you run different builds that
>> produce different classified artifacts but not at the same time?
>> Maven3 allows this, it used to be Maven that would break. Will double
>> check this in Nexus.
>>
>>>
>>> I don't know if the same problem exists with Artifactory...all I can
>>> say is that I have not seen these types of errors using that repo
>>> manager.
>>>
>>> Then there is the local repo size problem with timestamped
>>> snapshots...my hard drive is just not big enough for that.
>>> Timestamped snapshots is a solution to a problem I've never seen.  I
>>> expect snapshots to change so never want to be wed to a particular
>>> one.
>>>
>>> -Dave
>>>
>>> On Fri, Aug 24, 2012 at 3:27 PM, Laird Nelson <lj...@gmail.com> wrote:
>>>> On Fri, Aug 24, 2012 at 1:52 PM, David Hoffer <dh...@gmail.com> wrote:
>>>>
>>>>> We have been having nothing but trouble with Nexus and
>>>>> Maven3 with the time-stamped snapshots and all the various metadata
>>>>> files that Nexus spits out (which confuse Maven and IDEs).
>>>>
>>>>
>>>> Oh, so this whole thing is a Nexus problem?  Is that why none of my
>>>> maven-metadata.xml files in my SNAPSHOT directories in my Nexus repository
>>>> feature a <latest> tag (mind you, I'm guessing in the dark here about what
>>>> this tag is for, and also guessing that it is used in resolving SNAPSHOTs)?
>>>>  Am I wrong in thinking that these files *should* feature such a tag if
>>>> they are to be useful at all?  Where would I go to learn more information
>>>> about this?
>>>>
>>>> It certainly seems to be the case from others I've talked to that the
>>>> "solution" is "redeploy another SNAPSHOT; that's the only way to get rid of
>>>> this, and we don't know why it happens either".  Surely that can't be the
>>>> case.  Surely there's some way to convince Maven to figure out what the
>>>> latest SNAPSHOT is in a directory?  Or to otherwise help it correct its
>>>> mistaken belief that there are *no* *possible* snapshot resolutions?  Is
>>>> this a rare problem?
>>>>
>>>> Thanks for the input, David.
>>>>
>>>> Thanks,
>>>> Laird
>>>>
>>>> --
>>>> http://about.me/lairdnelson
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven/Nexus metadata interaction question

Posted by David Hoffer <dh...@gmail.com>.
There are several metadata files...the one I was referring to is
maven-metadata-nexus.xml.  Yeah I don't know for sure who generated
this Maven/Nexus...I just assumed Nexus because of the file name.

Yes in our builds we will sometimes run lesser important builds once a
day, or at night, javadocs is a good example.  Javadoc generation adds
considerably to the build time and doesn't have high value to be
generated with each build because they don't change that often...and
to be honest devs don't put much in javadocs anyway.

This worked fine with Maven2...since Maven2 just generated simple
snapshot jars it just overwrote the last one (which is what we want).
Now with Maven3/Nexus this is broke.

-Dave

On Fri, Aug 24, 2012 at 3:49 PM, Brian Fox <br...@infinity.nu> wrote:
> On Fri, Aug 24, 2012 at 5:43 PM, David Hoffer <dh...@gmail.com> wrote:
>> I can't say the whole problem is with Nexus.  I can say that the
>> requirement in Maven3 to always use timestamped snapshots has not be
>> addressed in a complete way with tools like Nexus and my beloved IDE
>> IntelliJ.  We have hundreds if not thousands of builds happening every
>> day and they should be able to generate artifacts with various
>> classifiers, i.e. sources.jar and javadoc.jar, etc.  But they don't
>> all have to generate all of these classifiers with each build.  I
>> might want to generate javadocs just at night because the build takes
>> too long, etc.  Well this completely breaks Nexus and IntelliJ because
>> Nexus will spit out a metadata file that says that the last
>> timestamped build is, lets say 45, well that might be true for one of
>> the artifacts, lets say it was javadocs, but 45 does not yet have
>> sources or the main jar artifact (the latest for those is 44).
>> However since Nexus advertised that build 45 is the latest, all the
>> tools, i.e. IntelliJ go looking for artifacts for that build number
>> and they do not exist.  So the only workaround for that is that all
>> builds must include all classifiers...can't do just the one we
>> need/want.
>
> This is an interesting use case, so you run different builds that
> produce different classified artifacts but not at the same time?
> Maven3 allows this, it used to be Maven that would break. Will double
> check this in Nexus.
>
>>
>> I don't know if the same problem exists with Artifactory...all I can
>> say is that I have not seen these types of errors using that repo
>> manager.
>>
>> Then there is the local repo size problem with timestamped
>> snapshots...my hard drive is just not big enough for that.
>> Timestamped snapshots is a solution to a problem I've never seen.  I
>> expect snapshots to change so never want to be wed to a particular
>> one.
>>
>> -Dave
>>
>> On Fri, Aug 24, 2012 at 3:27 PM, Laird Nelson <lj...@gmail.com> wrote:
>>> On Fri, Aug 24, 2012 at 1:52 PM, David Hoffer <dh...@gmail.com> wrote:
>>>
>>>> We have been having nothing but trouble with Nexus and
>>>> Maven3 with the time-stamped snapshots and all the various metadata
>>>> files that Nexus spits out (which confuse Maven and IDEs).
>>>
>>>
>>> Oh, so this whole thing is a Nexus problem?  Is that why none of my
>>> maven-metadata.xml files in my SNAPSHOT directories in my Nexus repository
>>> feature a <latest> tag (mind you, I'm guessing in the dark here about what
>>> this tag is for, and also guessing that it is used in resolving SNAPSHOTs)?
>>>  Am I wrong in thinking that these files *should* feature such a tag if
>>> they are to be useful at all?  Where would I go to learn more information
>>> about this?
>>>
>>> It certainly seems to be the case from others I've talked to that the
>>> "solution" is "redeploy another SNAPSHOT; that's the only way to get rid of
>>> this, and we don't know why it happens either".  Surely that can't be the
>>> case.  Surely there's some way to convince Maven to figure out what the
>>> latest SNAPSHOT is in a directory?  Or to otherwise help it correct its
>>> mistaken belief that there are *no* *possible* snapshot resolutions?  Is
>>> this a rare problem?
>>>
>>> Thanks for the input, David.
>>>
>>> Thanks,
>>> Laird
>>>
>>> --
>>> http://about.me/lairdnelson
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven/Nexus metadata interaction question

Posted by Brian Fox <br...@infinity.nu>.
On Sat, Aug 25, 2012 at 6:48 AM, Robert Scholte <rf...@apache.org> wrote:
>
> This sounds like https://jira.codehaus.org/browse/MNG-5324

Agree, that looks like the same thing. I tested all different forms of
this with Nexus and the metadata was verified to be correct each time.
I didn't check with Maven though, I was reviewing the data manually.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven/Nexus metadata interaction question

Posted by Robert Scholte <rf...@apache.org>.
Op Fri, 24 Aug 2012 23:49:43 +0200 schreef Brian Fox <br...@infinity.nu>:

> On Fri, Aug 24, 2012 at 5:43 PM, David Hoffer <dh...@gmail.com> wrote:
>> I can't say the whole problem is with Nexus.  I can say that the
>> requirement in Maven3 to always use timestamped snapshots has not be
>> addressed in a complete way with tools like Nexus and my beloved IDE
>> IntelliJ.  We have hundreds if not thousands of builds happening every
>> day and they should be able to generate artifacts with various
>> classifiers, i.e. sources.jar and javadoc.jar, etc.  But they don't
>> all have to generate all of these classifiers with each build.  I
>> might want to generate javadocs just at night because the build takes
>> too long, etc.  Well this completely breaks Nexus and IntelliJ because
>> Nexus will spit out a metadata file that says that the last
>> timestamped build is, lets say 45, well that might be true for one of
>> the artifacts, lets say it was javadocs, but 45 does not yet have
>> sources or the main jar artifact (the latest for those is 44).
>> However since Nexus advertised that build 45 is the latest, all the
>> tools, i.e. IntelliJ go looking for artifacts for that build number
>> and they do not exist.  So the only workaround for that is that all
>> builds must include all classifiers...can't do just the one we
>> need/want.
>
> This is an interesting use case, so you run different builds that
> produce different classified artifacts but not at the same time?
> Maven3 allows this, it used to be Maven that would break. Will double
> check this in Nexus.
>

This sounds like https://jira.codehaus.org/browse/MNG-5324

Robert

>>
>> I don't know if the same problem exists with Artifactory...all I can
>> say is that I have not seen these types of errors using that repo
>> manager.
>>
>> Then there is the local repo size problem with timestamped
>> snapshots...my hard drive is just not big enough for that.
>> Timestamped snapshots is a solution to a problem I've never seen.  I
>> expect snapshots to change so never want to be wed to a particular
>> one.
>>
>> -Dave
>>
>> On Fri, Aug 24, 2012 at 3:27 PM, Laird Nelson <lj...@gmail.com>  
>> wrote:
>>> On Fri, Aug 24, 2012 at 1:52 PM, David Hoffer <dh...@gmail.com>  
>>> wrote:
>>>
>>>> We have been having nothing but trouble with Nexus and
>>>> Maven3 with the time-stamped snapshots and all the various metadata
>>>> files that Nexus spits out (which confuse Maven and IDEs).
>>>
>>>
>>> Oh, so this whole thing is a Nexus problem?  Is that why none of my
>>> maven-metadata.xml files in my SNAPSHOT directories in my Nexus  
>>> repository
>>> feature a <latest> tag (mind you, I'm guessing in the dark here about  
>>> what
>>> this tag is for, and also guessing that it is used in resolving  
>>> SNAPSHOTs)?
>>>  Am I wrong in thinking that these files *should* feature such a tag if
>>> they are to be useful at all?  Where would I go to learn more  
>>> information
>>> about this?
>>>
>>> It certainly seems to be the case from others I've talked to that the
>>> "solution" is "redeploy another SNAPSHOT; that's the only way to get  
>>> rid of
>>> this, and we don't know why it happens either".  Surely that can't be  
>>> the
>>> case.  Surely there's some way to convince Maven to figure out what the
>>> latest SNAPSHOT is in a directory?  Or to otherwise help it correct its
>>> mistaken belief that there are *no* *possible* snapshot resolutions?   
>>> Is
>>> this a rare problem?
>>>
>>> Thanks for the input, David.
>>>
>>> Thanks,
>>> Laird
>>>
>>> --
>>> http://about.me/lairdnelson
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven/Nexus metadata interaction question

Posted by Brian Fox <br...@infinity.nu>.
On Fri, Aug 24, 2012 at 5:43 PM, David Hoffer <dh...@gmail.com> wrote:
> I can't say the whole problem is with Nexus.  I can say that the
> requirement in Maven3 to always use timestamped snapshots has not be
> addressed in a complete way with tools like Nexus and my beloved IDE
> IntelliJ.  We have hundreds if not thousands of builds happening every
> day and they should be able to generate artifacts with various
> classifiers, i.e. sources.jar and javadoc.jar, etc.  But they don't
> all have to generate all of these classifiers with each build.  I
> might want to generate javadocs just at night because the build takes
> too long, etc.  Well this completely breaks Nexus and IntelliJ because
> Nexus will spit out a metadata file that says that the last
> timestamped build is, lets say 45, well that might be true for one of
> the artifacts, lets say it was javadocs, but 45 does not yet have
> sources or the main jar artifact (the latest for those is 44).
> However since Nexus advertised that build 45 is the latest, all the
> tools, i.e. IntelliJ go looking for artifacts for that build number
> and they do not exist.  So the only workaround for that is that all
> builds must include all classifiers...can't do just the one we
> need/want.

This is an interesting use case, so you run different builds that
produce different classified artifacts but not at the same time?
Maven3 allows this, it used to be Maven that would break. Will double
check this in Nexus.

>
> I don't know if the same problem exists with Artifactory...all I can
> say is that I have not seen these types of errors using that repo
> manager.
>
> Then there is the local repo size problem with timestamped
> snapshots...my hard drive is just not big enough for that.
> Timestamped snapshots is a solution to a problem I've never seen.  I
> expect snapshots to change so never want to be wed to a particular
> one.
>
> -Dave
>
> On Fri, Aug 24, 2012 at 3:27 PM, Laird Nelson <lj...@gmail.com> wrote:
>> On Fri, Aug 24, 2012 at 1:52 PM, David Hoffer <dh...@gmail.com> wrote:
>>
>>> We have been having nothing but trouble with Nexus and
>>> Maven3 with the time-stamped snapshots and all the various metadata
>>> files that Nexus spits out (which confuse Maven and IDEs).
>>
>>
>> Oh, so this whole thing is a Nexus problem?  Is that why none of my
>> maven-metadata.xml files in my SNAPSHOT directories in my Nexus repository
>> feature a <latest> tag (mind you, I'm guessing in the dark here about what
>> this tag is for, and also guessing that it is used in resolving SNAPSHOTs)?
>>  Am I wrong in thinking that these files *should* feature such a tag if
>> they are to be useful at all?  Where would I go to learn more information
>> about this?
>>
>> It certainly seems to be the case from others I've talked to that the
>> "solution" is "redeploy another SNAPSHOT; that's the only way to get rid of
>> this, and we don't know why it happens either".  Surely that can't be the
>> case.  Surely there's some way to convince Maven to figure out what the
>> latest SNAPSHOT is in a directory?  Or to otherwise help it correct its
>> mistaken belief that there are *no* *possible* snapshot resolutions?  Is
>> this a rare problem?
>>
>> Thanks for the input, David.
>>
>> Thanks,
>> Laird
>>
>> --
>> http://about.me/lairdnelson
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven/Nexus metadata interaction question

Posted by David Hoffer <dh...@gmail.com>.
I can't say the whole problem is with Nexus.  I can say that the
requirement in Maven3 to always use timestamped snapshots has not be
addressed in a complete way with tools like Nexus and my beloved IDE
IntelliJ.  We have hundreds if not thousands of builds happening every
day and they should be able to generate artifacts with various
classifiers, i.e. sources.jar and javadoc.jar, etc.  But they don't
all have to generate all of these classifiers with each build.  I
might want to generate javadocs just at night because the build takes
too long, etc.  Well this completely breaks Nexus and IntelliJ because
Nexus will spit out a metadata file that says that the last
timestamped build is, lets say 45, well that might be true for one of
the artifacts, lets say it was javadocs, but 45 does not yet have
sources or the main jar artifact (the latest for those is 44).
However since Nexus advertised that build 45 is the latest, all the
tools, i.e. IntelliJ go looking for artifacts for that build number
and they do not exist.  So the only workaround for that is that all
builds must include all classifiers...can't do just the one we
need/want.

I don't know if the same problem exists with Artifactory...all I can
say is that I have not seen these types of errors using that repo
manager.

Then there is the local repo size problem with timestamped
snapshots...my hard drive is just not big enough for that.
Timestamped snapshots is a solution to a problem I've never seen.  I
expect snapshots to change so never want to be wed to a particular
one.

-Dave

On Fri, Aug 24, 2012 at 3:27 PM, Laird Nelson <lj...@gmail.com> wrote:
> On Fri, Aug 24, 2012 at 1:52 PM, David Hoffer <dh...@gmail.com> wrote:
>
>> We have been having nothing but trouble with Nexus and
>> Maven3 with the time-stamped snapshots and all the various metadata
>> files that Nexus spits out (which confuse Maven and IDEs).
>
>
> Oh, so this whole thing is a Nexus problem?  Is that why none of my
> maven-metadata.xml files in my SNAPSHOT directories in my Nexus repository
> feature a <latest> tag (mind you, I'm guessing in the dark here about what
> this tag is for, and also guessing that it is used in resolving SNAPSHOTs)?
>  Am I wrong in thinking that these files *should* feature such a tag if
> they are to be useful at all?  Where would I go to learn more information
> about this?
>
> It certainly seems to be the case from others I've talked to that the
> "solution" is "redeploy another SNAPSHOT; that's the only way to get rid of
> this, and we don't know why it happens either".  Surely that can't be the
> case.  Surely there's some way to convince Maven to figure out what the
> latest SNAPSHOT is in a directory?  Or to otherwise help it correct its
> mistaken belief that there are *no* *possible* snapshot resolutions?  Is
> this a rare problem?
>
> Thanks for the input, David.
>
> Thanks,
> Laird
>
> --
> http://about.me/lairdnelson

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven/Nexus metadata interaction question

Posted by Brian Fox <br...@infinity.nu>.
On Fri, Aug 24, 2012 at 5:27 PM, Laird Nelson <lj...@gmail.com> wrote:
> On Fri, Aug 24, 2012 at 1:52 PM, David Hoffer <dh...@gmail.com> wrote:
>
>> We have been having nothing but trouble with Nexus and
>> Maven3 with the time-stamped snapshots and all the various metadata
>> files that Nexus spits out (which confuse Maven and IDEs).
>

Let me fill in a few details that aren't quite right in this thread:

Maven produces the maven-metadata.xml files, not Nexus. Nexus is able
to repair them if needed (or if they are missing from another build)
but otherwise the file is untouched. You can repair them by right
clicking the folder in the repository view and selecting repair
metadata.

>
> Oh, so this whole thing is a Nexus problem?  Is that why none of my
> maven-metadata.xml files in my SNAPSHOT directories in my Nexus repository
> feature a <latest> tag

The LATEST tag is completely unrelated to the SNAPSHOT to
timestamp-buildnumber conversion that Maven does. LATEST and RELEASE
are key words that can be used in place of a version in your pom, but
these have been anti-patterns for a long time. When Maven wants to
find the timestamped file, it reads the maven-metadata.xml and looks
for the <timestamp> and <buildnumber> tags:

<versioning>
<snapshot>
<timestamp>20120809.231215</timestamp>
<buildNumber>116</buildNumber>


Latest itself is again generated by Maven, but isn't required for
snapshot resolution.

(mind you, I'm guessing in the dark here about what
> this tag is for, and also guessing that it is used in resolving SNAPSHOTs)?
>  Am I wrong in thinking that these files *should* feature such a tag if
> they are to be useful at all?  Where would I go to learn more information
> about this?
>
> It certainly seems to be the case from others I've talked to that the
> "solution" is "redeploy another SNAPSHOT; that's the only way to get rid of
> this, and we don't know why it happens either".  Surely that can't be the
> case.  Surely there's some way to convince Maven to figure out what the
> latest SNAPSHOT is in a directory?  Or to otherwise help it correct its
> mistaken belief that there are *no* *possible* snapshot resolutions?  Is
> this a rare problem?



A few more things could help narrow this down:
If you read the maven-metadata.xml from the repository, what's in it?
I'm presuming you have the snapshot repository included in a group
repo, which is what Maven is actually reading. When you fetch from
that url, what's in it?

Checking each of those urls would eliminate any negative caching
effects that Nexus might be doing. It would also confirm that the
group repo is configured properly

If those urls both show the correct data as you pasted in the original
post, then check and see what's in your local repo for that location.
It's possible that Maven isn't actually requesting the file from Nexus
and is instead resolving something incorrectly from the local repo.


>
> Thanks for the input, David.
>
> Thanks,
> Laird
>
> --
> http://about.me/lairdnelson

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven/Nexus metadata interaction question

Posted by Laird Nelson <lj...@gmail.com>.
On Fri, Aug 24, 2012 at 1:52 PM, David Hoffer <dh...@gmail.com> wrote:

> We have been having nothing but trouble with Nexus and
> Maven3 with the time-stamped snapshots and all the various metadata
> files that Nexus spits out (which confuse Maven and IDEs).


Oh, so this whole thing is a Nexus problem?  Is that why none of my
maven-metadata.xml files in my SNAPSHOT directories in my Nexus repository
feature a <latest> tag (mind you, I'm guessing in the dark here about what
this tag is for, and also guessing that it is used in resolving SNAPSHOTs)?
 Am I wrong in thinking that these files *should* feature such a tag if
they are to be useful at all?  Where would I go to learn more information
about this?

It certainly seems to be the case from others I've talked to that the
"solution" is "redeploy another SNAPSHOT; that's the only way to get rid of
this, and we don't know why it happens either".  Surely that can't be the
case.  Surely there's some way to convince Maven to figure out what the
latest SNAPSHOT is in a directory?  Or to otherwise help it correct its
mistaken belief that there are *no* *possible* snapshot resolutions?  Is
this a rare problem?

Thanks for the input, David.

Thanks,
Laird

-- 
http://about.me/lairdnelson

Re: Maven/Nexus metadata interaction question

Posted by David Hoffer <dh...@gmail.com>.
I haven't seen that exact problem but I feel your pain.  I too spent
the better part of today trying to figure out why my build was
failing.  We have been having nothing but trouble with Nexus and
Maven3 with the time-stamped snapshots and all the various metadata
files that Nexus spits out (which confuse Maven and IDEs).  We thought
we had those resolved so now Nexus refuses to update the regular pom
file (the non-timestamped) one and of course that broke the build.  I
long for the Maven2 days of no timestamped snapshots.  Only way to
reliably build with Nexus/Maven3 is to delete the local repo it
seems...or replace Nexus with Artifactory perhaps.

On Fri, Aug 24, 2012 at 2:31 PM, Laird Nelson <lj...@gmail.com> wrote:
> I fear this is a stupid question, but I can't find any information anywhere
> about Maven metadata.  :-(
>
> I have the world's simplest Jenkins/Maven/Nexus setup.
>
> I have a job on Jenkins that (today only, never before) began failing
> because it claims it cannot resolve various SNAPSHOT artifacts from Nexus.
>  It is effectively invoking mvn -U clean install on an ear project, which
> (of course, as you'd expect) has various runtime dependencies.
>
> The various errors look like this:
>
> Caused by: org.apache.maven.model.resolution.UnresolvableModelException:
> Could not find artifact com.foobar.pomtype-api:pom:1.009-SNAPSHOT
>
>
> But the pomtype-api/1.009-SNAPSHOT directory is of course present, in
> the very repository that Maven itself simultaneously documents as the
> place it's looking and the place that theoretically does not contain
> the artifact.  It is chock full of timestamped snapshots, each of
> which has a .pom extension, and each of which was uploaded
> successfully by a previous Jenkins job.
>
>
> I have run across this issue various times over the years and have
> always chalked it up to black magic.  Some combination of poking and
> prodding and redoing and waiting and -U etc. always seems to clear the
> mud out of the mechanism.  Not this time, and I'm tired of not
> understanding how this all works.
>
>
> Guessing in the dark, I'm assuming that Maven is somehow not able to
> figure out how to turn "1.009-SNAPSHOT" into, e.g.,
> "1.009-20120621.124828-107" and thus concludes that there is no
> 1.009-SNAPSHOT artifact at all.  Equally in the dark, I'm presuming
> this has something to do with the (undocumented?) maven-metadata.xml
> file, which doesn't seem to contain any useful information:
>
>
> <metadata modelVersion="1.1.0">
> <groupId>com.foobar</groupId>
> <artifactId>pomtype-api</artifactId>
> <version>1.009-SNAPSHOT</version>
> <versioning>
> <snapshot>
> <timestamp>20120809.231215</timestamp>
> <buildNumber>116</buildNumber>
> </snapshot>
> <lastUpdated>20120809231215</lastUpdated>
> <snapshotVersions>
> <snapshotVersion>
> <extension>pom</extension>
> <value>1.009-20120809.231215-116</value>
> <updated>20120809231215</updated>
> </snapshotVersion>
> <snapshotVersion>
> <classifier>tests</classifier>
> <extension>jar</extension>
> <value>1.009-20120809.231215-116</value>
> <updated>20120809231215</updated>
> </snapshotVersion>
> </snapshotVersions>
> </versioning>
> </metadata>
>
>
> I don't see how Maven could conclude much from this, but this seems to
> be what it consults as part of its resolving snapshots; I can see this
> being downloaded in the logs.
>
>
> When Maven heads off to resolve 1.009-SNAPSHOT to a timestamped
> version, how does it do it?  Why doesn't--in this case--it pick the
> "most recent" snapshot, and what would cause it to do so?
>
>
> Let's pretend just for kicks that redeploying a new snapshot is not a
> possibility (the answer SURELY can't be to redeploy a new snapshot to
> somehow cause the magic to happen).  What steps should I take?  Where
> do I start looking to resolve this issue?
>
>
> Thanks,
>
> Laird
>
>
> --
> http://about.me/lairdnelson

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org