You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Vidar Ramdal <vi...@idium.no> on 2011/02/11 15:21:47 UTC

How to update metadata element?

I'm trying to understand how Maven updates the <latest> element in
maven-metadata.xml - or more specifically, why it doesn't.

When I do a mvn deploy of a snapshot build, Maven uploads the
artifacts to my Maven repository. Good. It also updates the elements
<version>, and adds a new element under <versioning><versions> in
maven-metadata.xml

But I would expect Maven to also create/update a <latest> element, as
I have seen in many other Maven repositories. Why does this not
happen?

(I am aware that many are discouraging the use of LATEST when
specifying dependency versions. The main reason I want to use it in
this case, is to reference it for use with maven-launchpad-plugin [1].
This would allow me to have automated builds with the bleeding-edge
versions of all artifacts. If there are other ways to accomplish this,
I'm happy to try different approaches.)

[1] http://sling.apache.org/site/maven-launchpad-plugin.html

-- 
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Sommerrogata 13-15, N-0255 Oslo, Norway
+ 47 22 00 84 00
Quando omni flunkus moritatus!

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


Re: How to update metadata element?

Posted by Vidar Ramdal <vi...@idium.no>.
On Fri, Feb 11, 2011 at 3:56 PM, Benjamin Bentmann
<be...@udo.edu> wrote:
> Vidar Ramdal wrote:
>
>> Could you elaborate on this? Does it mean that<latest>  is some kind
>> of internal Maven stuff that cannot be relied on?
>
> Exactly, it supports automatic plugin version resolution.

So <latest> is only used for plugins, if I understand correctly. Good to know.

>> Unfortunately it doesn't work for me (could be an issue with
>> maven-launchpad-plugin).
>> I'm getting this when building:
>> java.lang.NullPointerException: version was null for
>> com.idium.kolibri:kolibri-cache-util
>>        at
>> org.apache.maven.artifact.DefaultArtifact.getBaseVersion(DefaultArtifact.java:390)
>>        at
>> org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout.pathOf(DefaultRepositoryLayout.java:47)
>>        at
>> org.apache.maven.artifact.repository.DefaultArtifactRepository.pathOf(DefaultArtifactRepository.java:110)
>>        at
>> org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:141)
>>        at
>> org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
>>        at
>> org.apache.sling.maven.projectsupport.AbstractBundleListMojo.getArtifact(AbstractBundleListMojo.java:196)
>
> You need to resolve a version range first and pick a specific version before
> trying to resolve an artifact. IIRC, it was something along the lines of
> MavenMetadataSource.retrieveAvailableVersions() followed by a call to
> VersionRange.matchVersion() to select the version.

I'll report this as an issue against maven-launchpad-plugin.

Thanks for your help!

-- 
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Sommerrogata 13-15, N-0255 Oslo, Norway
+ 47 22 00 84 00
Quando omni flunkus moritatus!

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


Re: How to update metadata element?

Posted by Benjamin Bentmann <be...@udo.edu>.
Vidar Ramdal wrote:

> Could you elaborate on this? Does it mean that<latest>  is some kind
> of internal Maven stuff that cannot be relied on?

Exactly, it supports automatic plugin version resolution.

> Unfortunately it doesn't work for me (could be an issue with
> maven-launchpad-plugin).
> I'm getting this when building:
> java.lang.NullPointerException: version was null for
> com.idium.kolibri:kolibri-cache-util
> 	at org.apache.maven.artifact.DefaultArtifact.getBaseVersion(DefaultArtifact.java:390)
> 	at org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout.pathOf(DefaultRepositoryLayout.java:47)
> 	at org.apache.maven.artifact.repository.DefaultArtifactRepository.pathOf(DefaultArtifactRepository.java:110)
> 	at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:141)
> 	at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
> 	at org.apache.sling.maven.projectsupport.AbstractBundleListMojo.getArtifact(AbstractBundleListMojo.java:196)

You need to resolve a version range first and pick a specific version 
before trying to resolve an artifact. IIRC, it was something along the 
lines of MavenMetadataSource.retrieveAvailableVersions() followed by a 
call to VersionRange.matchVersion() to select the version.


Benjamin

>


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


Re: How to update metadata element?

Posted by Vidar Ramdal <vi...@idium.no>.
On Fri, Feb 11, 2011 at 3:36 PM, Benjamin Bentmann
<be...@udo.edu> wrote:
> Vidar Ramdal wrote:
>
>> I'm trying to understand how Maven updates the<latest>  element in
>> maven-metadata.xml - or more specifically, why it doesn't.
>
> Oh it does, when Maven itself needs it.

So then I guess my question is: When does Maven itself need it? Is
there any documentation around this?

> It's not a general purpose feature of the metadata.

Could you elaborate on this? Does it mean that <latest> is some kind
of internal Maven stuff that cannot be relied on?

>> (I am aware that many are discouraging the use of LATEST when
>> specifying dependency versions. The main reason I want to use it in
>> this case, is to reference it for use with maven-launchpad-plugin [1].
>> This would allow me to have automated builds with the bleeding-edge
>> versions of all artifacts. If there are other ways to accomplish this,
>> I'm happy to try different approaches.)
>
> A version range [0,) might be worth a try.

Unfortunately it doesn't work for me (could be an issue with
maven-launchpad-plugin).
I'm getting this when building:
java.lang.NullPointerException: version was null for
com.idium.kolibri:kolibri-cache-util
	at org.apache.maven.artifact.DefaultArtifact.getBaseVersion(DefaultArtifact.java:390)
	at org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout.pathOf(DefaultRepositoryLayout.java:47)
	at org.apache.maven.artifact.repository.DefaultArtifactRepository.pathOf(DefaultArtifactRepository.java:110)
	at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:141)
	at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
	at org.apache.sling.maven.projectsupport.AbstractBundleListMojo.getArtifact(AbstractBundleListMojo.java:196)

-- 
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Sommerrogata 13-15, N-0255 Oslo, Norway
+ 47 22 00 84 00
Quando omni flunkus moritatus!

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


Re: How to update metadata element?

Posted by Benjamin Bentmann <be...@udo.edu>.
Vidar Ramdal wrote:

> I'm trying to understand how Maven updates the<latest>  element in
> maven-metadata.xml - or more specifically, why it doesn't.

Oh it does, when Maven itself needs it. It's not a general purpose 
feature of the metadata.

> (I am aware that many are discouraging the use of LATEST when
> specifying dependency versions. The main reason I want to use it in
> this case, is to reference it for use with maven-launchpad-plugin [1].
> This would allow me to have automated builds with the bleeding-edge
> versions of all artifacts. If there are other ways to accomplish this,
> I'm happy to try different approaches.)

A version range [0,) might be worth a try.


Benjamin

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