Novice nexus oss (2.0.0) user here – getting unexpected results when requesting v=LATEST artifact from our hosted repo. I am hoping someone could explain what is wrong with our maven-metadata.xml (or my expectations of what v=LATEST returns). We have an
non-plugin JAR artifact “castanealabs-config” in Snapshots repo (published via maven-deploy-plugin, fwiw). The two most recent versions are 10-SNAPSHOT and 11-SNAPSHOT. The latter was published most recently (and has the highest version by maven convention,
as I understand it). Yet Nexus REST API (/artifact/maven/{resolve,redirect}) keeps returning most recent snapshot of 10-SNAPSHOT instead when asked for v=LATEST.

Why?

What inputs (from maven-metadata.xml at /group/artifact/maven-metadata.xml) does API evaluate to arrive at 10-SNAPSHOT. API responses below; attached are  maven-metadata.xml  files for:

1)      10-SNAPSHOT

2)      11-SNAPSHOT

3)      artifact

Notice that in artifact’s maven-metadata.xml lastUpdated matches the timestamp of 11-SNAPSHOT. From reading Nexus FAQ, my understanding is that versioning/latest attribute in that file is irrelevant since this is a non-plugin artifact.

Thank you,

-nikita

Asking /resolve for ‘v=LATEST’:

$curl –uxxx:xxx -i "http://host/nexus/service/local/artifact/maven/resolve?g=com.castanealabs&a=castanealabs-config&v=LATEST&r=snapshots"

HTTP/1.1 200 OK

Date: Tue, 20 Mar 2012 22:08:19 GMT

Set-Cookie: rememberMe=deleteMe; Path=/nexus; Max-Age=0; Expires=Mon, 19-Mar-2012 22:08:19 GMT

Content-Type: application/xml; charset=UTF-8

Date: Tue, 20 Mar 2012 22:08:19 GMT

Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept

Server: Noelios-Restlet-Engine/1.1.6-SONATYPE-5348-V4

Content-Length: 638

<artifact-resolution>

<data>

<presentLocally>true</presentLocally>

<groupId>com.castanealabs</groupId>

<artifactId>castanealabs-config</artifactId>

    <version>10-20120320.074835-5</version>

    <baseVersion>10-SNAPSHOT</baseVersion>

<extension>jar</extension>

<snapshot>true</snapshot>

<snapshotBuildNumber>5</snapshotBuildNumber>

    <snapshotTimeStamp>1332229715000</snapshotTimeStamp>

<sha1>f107b5dd710dc3dbac8029ecb3f394b265e7c078</sha1>

<repositoryPath>/com/castanealabs/castanealabs-config/10-SNAPSHOT/castanealabs-config-10-20120320.074835-5.jar</repositoryPath>

</data>

</artifact-resolution>

Now ask for 11-SNAPSHOT explicitly – notice more recent <version/>:

$curl –uxxx:xxx -i "http://host/nexus/service/local/artifact/maven/resolve?g=com.castanealabs&a=castanealabs-config&v=11-SNAPSHOT&r=snapshots"

HTTP/1.1 200 OK

Date: Tue, 20 Mar 2012 22:12:48 GMT

Set-Cookie: rememberMe=deleteMe; Path=/nexus; Max-Age=0; Expires=Mon, 19-Mar-2012 22:12:48 GMT

Content-Type: application/xml; charset=UTF-8

Date: Tue, 20 Mar 2012 22:12:48 GMT

Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept

Server: Noelios-Restlet-Engine/1.1.6-SONATYPE-5348-V4

Content-Length: 638

<artifact-resolution>

<data>

<presentLocally>true</presentLocally>

<groupId>com.castanealabs</groupId>

<artifactId>castanealabs-config</artifactId>

    <version>11-20120320.181629-2</version>

    <baseVersion>11-SNAPSHOT</baseVersion>

<extension>jar</extension>

<snapshot>true</snapshot>

<snapshotBuildNumber>2</snapshotBuildNumber>

    <snapshotTimeStamp>1332267389000</snapshotTimeStamp>

<sha1>d90c05740d587ae57fddd2318fc40258104283e2</sha1>

<repositoryPath>/com/castanealabs/castanealabs-config/11-SNAPSHOT/castanealabs-config-11-20120320.181629-2.jar</repositoryPath>

</data>

</artifact-resolution>

Maven-metadata.xml at /group/artifact/ level:

<?xml version="1.0" encoding="UTF-8"?>

<metadata>

<groupId>com.castanealabs</groupId>

<artifactId>castanealabs-config</artifactId>

<versioning>

<latest>10-SNAPSHOT</latest>

<release></release>

<versions>

<version>1.0-SNAPSHOT</version>

<version>7-SNAPSHOT</version>

<version>8-SNAPSHOT</version>

<version>10-SNAPSHOT</version>

<version>11-SNAPSHOT</version>

</versions>

<lastUpdated>20120320181629</lastUpdated>

</versioning>

</metadata>

--------------------------------------------------------------------- 

To unsubscribe, e-mail: [hidden email] 

For additional commands, e-mail: [hidden email]



 maven-metadata-10-SNAPSHOT.xml (907 bytes) Download
Attachment


 maven-metadata-11-SNAPSHOT.xml (907 bytes) Download
Attachment


 maven-metadata-artifact.xml (587 bytes) Download
Attachment
Reply | Threaded |   

RE: nexus REST API /artifact/maven/[resolve|redirect] returns unexpected for v=LATEST

Update: I observed the following:

·         Running ‘rebuild metadata’ on repository from nexus UI fixes the problem – specifically API responds to v=LATEST with newest version (11-SNAPSHOT in the case below)

·         The only change to maven-metadata.xml from the above is: <latest/> updated from 10-SNAPSHOT to 11-SNAPSHOT. So ‘latest’ does matter for non-plugin artifacts – contrary
to the FAQ (http://bit.ly/GEurFo )?

·         The cycle repeats, however – after newer 12-SNAPSHOT is published, maven-metadata.xml still lists 11-SNAPSHOT as <latest/> (albeit listing lastUpdated matching 12-SNAPSHOT)
and Nexus API responds with 11-SNAPSHOT when asked for ‘v=LATEST’

So, seems like one of the following must be true:

1)      Mvn deploy uploads incorrect maven-metadata.xml (and <latest/> does matter)

a.       I ran mvn deploy against a local file repo, and the resulting maven-metadata.xml did not have <latest/> property at all (using mvn 3.0.4 and maven-deploy-plugin 2.7)

2)      Nexus does something to maven-metadata.xml on upload and the resulting file has wrong <latest/>

3)      <latest/> is indeed irrelevant and Nexus REST API returns wrong version for some other reason (can Nexus API be caching a response?)

From: Nikita Tovstoles [mailto:[hidden email]

Sent: Tuesday, March 20, 2012 5:25 PM

To: [hidden email]

Subject: [nexus-user] nexus REST API /artifact/maven/[resolve|redirect] returns unexpected for v=LATEST

Novice nexus oss (2.0.0) user here – getting unexpected results when requesting v=LATEST artifact from our hosted repo. I am hoping someone could explain what is wrong with our maven-metadata.xml (or my expectations of what v=LATEST returns). We have an
non-plugin JAR artifact “castanealabs-config” in Snapshots repo (published via maven-deploy-plugin, fwiw). The two most recent versions are 10-SNAPSHOT and 11-SNAPSHOT. The latter was published most recently (and has the highest version by maven convention,
as I understand it). Yet Nexus REST API (/artifact/maven/{resolve,redirect}) keeps returning most recent snapshot of 10-SNAPSHOT instead when asked for v=LATEST.

Why?

What inputs (from maven-metadata.xml at /group/artifact/maven-metadata.xml) does API evaluate to arrive at 10-SNAPSHOT. API responses below; attached are  maven-metadata.xml  files for:

1)      10-SNAPSHOT

2)      11-SNAPSHOT

3)      artifact

Notice that in artifact’s maven-metadata.xml lastUpdated matches the timestamp of 11-SNAPSHOT. From reading Nexus FAQ, my understanding is that versioning/latest attribute in that file is irrelevant since this is a non-plugin artifact.

Thank you,

-nikita

Asking /resolve for ‘v=LATEST’:

$curl –uxxx:xxx -i "http://host/nexus/service/local/artifact/maven/resolve?g=com.castanealabs&a=castanealabs-config&v=LATEST&r=snapshots"

HTTP/1.1 200 OK

Date: Tue, 20 Mar 2012 22:08:19 GMT

Set-Cookie: rememberMe=deleteMe; Path=/nexus; Max-Age=0; Expires=Mon, 19-Mar-2012 22:08:19 GMT

Content-Type: application/xml; charset=UTF-8

Date: Tue, 20 Mar 2012 22:08:19 GMT

Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept

Server: Noelios-Restlet-Engine/1.1.6-SONATYPE-5348-V4

Content-Length: 638

<artifact-resolution>

<data>

<presentLocally>true</presentLocally>

<groupId>com.castanealabs</groupId>

<artifactId>castanealabs-config</artifactId>

    <version>10-20120320.074835-5</version>

    <baseVersion>10-SNAPSHOT</baseVersion>

<extension>jar</extension>

<snapshot>true</snapshot>

<snapshotBuildNumber>5</snapshotBuildNumber>

    <snapshotTimeStamp>1332229715000</snapshotTimeStamp>

<sha1>f107b5dd710dc3dbac8029ecb3f394b265e7c078</sha1>

<repositoryPath>/com/castanealabs/castanealabs-config/10-SNAPSHOT/castanealabs-config-10-20120320.074835-5.jar</repositoryPath>

</data>

</artifact-resolution>

Now ask for 11-SNAPSHOT explicitly – notice more recent <version/>:

$curl –uxxx:xxx -i "http://host/nexus/service/local/artifact/maven/resolve?g=com.castanealabs&a=castanealabs-config&v=11-SNAPSHOT&r=snapshots"

HTTP/1.1 200 OK

Date: Tue, 20 Mar 2012 22:12:48 GMT

Set-Cookie: rememberMe=deleteMe; Path=/nexus; Max-Age=0; Expires=Mon, 19-Mar-2012 22:12:48 GMT

Content-Type: application/xml; charset=UTF-8

Date: Tue, 20 Mar 2012 22:12:48 GMT

Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept

Server: Noelios-Restlet-Engine/1.1.6-SONATYPE-5348-V4

Content-Length: 638

<artifact-resolution>

<data>

<presentLocally>true</presentLocally>

<groupId>com.castanealabs</groupId>

<artifactId>castanealabs-config</artifactId>

    <version>11-20120320.181629-2</version>

    <baseVersion>11-SNAPSHOT</baseVersion>

<extension>jar</extension>

<snapshot>true</snapshot>

<snapshotBuildNumber>2</snapshotBuildNumber>

    <snapshotTimeStamp>1332267389000</snapshotTimeStamp>

<sha1>d90c05740d587ae57fddd2318fc40258104283e2</sha1>

<repositoryPath>/com/castanealabs/castanealabs-config/11-SNAPSHOT/castanealabs-config-11-20120320.181629-2.jar</repositoryPath>

</data>

</artifact-resolution>

Maven-metadata.xml at /group/artifact/ level:

<?xml version="1.0" encoding="UTF-8"?>

<metadata>

<groupId>com.castanealabs</groupId>

<artifactId>castanealabs-config</artifactId>

<versioning>

<latest>10-SNAPSHOT</latest>

<release></release>

<versions>

<version>1.0-SNAPSHOT</version>

<version>7-SNAPSHOT</version>

<version>8-SNAPSHOT</version>

<version>10-SNAPSHOT</version>

<version>11-SNAPSHOT</version>

</versions>

<lastUpdated>20120320181629</lastUpdated>

</versioning>

</metadata>

Reply | Threaded |   

Re: nexus REST API /artifact/maven/[resolve|redirect] returns unexpected for v=LATEST

<base href="x-msg://11/">

On 22 Mar 2012, at 11:48, Nikita Tovstoles wrote:
Update: I observed the following:
·         Running ‘rebuild metadata’ on repository from nexus UI fixes the problem – specifically API responds to v=LATEST with newest version (11-SNAPSHOT in the case below)
·         The only change to maven-metadata.xml from the above is: <latest/> updated from 10-SNAPSHOT to 11-SNAPSHOT. So ‘latest’ does matter for non-plugin artifacts – contrary
to the FAQ (http://bit.ly/GEurFo )?
·         The cycle repeats, however – after newer 12-SNAPSHOT is published, maven-metadata.xml still lists 11-SNAPSHOT as <latest/> (albeit listing lastUpdated matching 12-SNAPSHOT)
and Nexus API responds with 11-SNAPSHOT when asked for ‘v=LATEST’
 
So, seems like one of the following must be true:
1)      Mvn deploy uploads incorrect maven-metadata.xml (and <latest/> does matter)
a.       I ran mvn deploy against a local file repo, and the resulting maven-metadata.xml did not have <latest/> property at all (using mvn 3.0.4 and maven-deploy-plugin 2.7)
2)      Nexus does something to maven-metadata.xml on upload and the resulting file has wrong <latest/>
3)      <latest/> is indeed irrelevant and Nexus REST API returns wrong version for some other reason (can Nexus API be caching a response?)
 

Nexus only modifies the Maven metadata for a given repository when you explicitly ask to rebuild it, otherwise it is left to Maven to update.

However, Maven no longer updates the LATEST tag on deploy, see http://jira.codehaus.org/browse/MDEPLOY-103 and its linked issues.
 
 
From: Nikita Tovstoles [mailto:[hidden email]

Sent: Tuesday, March 20, 2012 5:25 PM

To: [hidden email]

Subject: [nexus-user] nexus REST API /artifact/maven/[resolve|redirect] returns unexpected for v=LATEST
 
Novice nexus oss (2.0.0) user here – getting unexpected results when requesting v=LATEST artifact from our hosted repo. I am hoping someone could explain what is wrong with our maven-metadata.xml (or my expectations of what v=LATEST returns). We have an
non-plugin JAR artifact “castanealabs-config” in Snapshots repo (published via maven-deploy-plugin, fwiw). The two most recent versions are 10-SNAPSHOT and 11-SNAPSHOT. The latter was published most recently (and has the highest version by maven convention,
as I understand it). Yet Nexus REST API (/artifact/maven/{resolve,redirect}) keeps returning most recent snapshot of 10-SNAPSHOT instead when asked for v=LATEST.
 
Why?
What inputs (from maven-metadata.xml at /group/artifact/maven-metadata.xml) does API evaluate to arrive at 10-SNAPSHOT. API responses below; attached are  maven-metadata.xml  files for:
1)      10-SNAPSHOT
2)      11-SNAPSHOT
3)      artifact
 
Notice that in artifact’s maven-metadata.xml lastUpdated matches the timestamp of 11-SNAPSHOT. From reading Nexus FAQ, my understanding is that versioning/latest attribute in that file is irrelevant since this is a non-plugin artifact.
 
Thank you,
-nikita
 
Asking /resolve for ‘v=LATEST’:
 
HTTP/1.1 200 OK
Date: Tue, 20 Mar 2012 22:08:19 GMT
Set-Cookie: rememberMe=deleteMe; Path=/nexus; Max-Age=0; Expires=Mon, 19-Mar-2012 22:08:19 GMT
Content-Type: application/xml; charset=UTF-8
Date: Tue, 20 Mar 2012 22:08:19 GMT
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Server: Noelios-Restlet-Engine/1.1.6-SONATYPE-5348-V4
Content-Length: 638
 
<artifact-resolution>
  <data>
    <presentLocally>true</presentLocally>
    <groupId>com.castanealabs</groupId>
    <artifactId>castanealabs-config</artifactId>
    <version>10-20120320.074835-5</version>
    <baseVersion>10-SNAPSHOT</baseVersion>
    <extension>jar</extension>
    <snapshot>true</snapshot>
    <snapshotBuildNumber>5</snapshotBuildNumber>
    <snapshotTimeStamp>1332229715000</snapshotTimeStamp>
    <sha1>f107b5dd710dc3dbac8029ecb3f394b265e7c078</sha1>
    <repositoryPath>/com/castanealabs/castanealabs-config/10-SNAPSHOT/castanealabs-config-10-20120320.074835-5.jar</repositoryPath>
  </data>
</artifact-resolution>
 
Now ask for 11-SNAPSHOT explicitly – notice more recent <version/>:
 
HTTP/1.1 200 OK
Date: Tue, 20 Mar 2012 22:12:48 GMT
Set-Cookie: rememberMe=deleteMe; Path=/nexus; Max-Age=0; Expires=Mon, 19-Mar-2012 22:12:48 GMT
Content-Type: application/xml; charset=UTF-8
Date: Tue, 20 Mar 2012 22:12:48 GMT
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Server: Noelios-Restlet-Engine/1.1.6-SONATYPE-5348-V4
Content-Length: 638
 
<artifact-resolution>
  <data>
    <presentLocally>true</presentLocally>
    <groupId>com.castanealabs</groupId>
    <artifactId>castanealabs-config</artifactId>
    <version>11-20120320.181629-2</version>
    <baseVersion>11-SNAPSHOT</baseVersion>
    <extension>jar</extension>
    <snapshot>true</snapshot>
    <snapshotBuildNumber>2</snapshotBuildNumber>
    <snapshotTimeStamp>1332267389000</snapshotTimeStamp>
    <sha1>d90c05740d587ae57fddd2318fc40258104283e2</sha1>
    <repositoryPath>/com/castanealabs/castanealabs-config/11-SNAPSHOT/castanealabs-config-11-20120320.181629-2.jar</repositoryPath>
  </data>
</artifact-resolution>
 
 
Maven-metadata.xml at /group/artifact/ level:
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.castanealabs</groupId>
<artifactId>castanealabs-config</artifactId>
<versioning>
<latest>10-SNAPSHOT</latest>
<release></release>
<versions>
<version>1.0-SNAPSHOT</version>
<version>7-SNAPSHOT</version>
<version>8-SNAPSHOT</version>
<version>10-SNAPSHOT</version>
<version>11-SNAPSHOT</version>
</versions>
<lastUpdated>20120320181629</lastUpdated>
</versioning>
</metadata>
 
 
 
 

Reply | Threaded |   

RE: nexus REST API /artifact/maven/[resolve|redirect] returns unexpected for v=LATEST

<base href="x-msg://11/">

Thanks for the tip, Stuart. I think I understand what’s happening but do have a “am I ”:

1)      I see that artifact maven-metadata.xml, generated by deploy goal  (Mvn 3.0.4 and maven-deploy-plugin  2.7) does NOT contain <latest/> property at all – and understand that
the file is unaltered when uploaded to nexus repo. (I verified by running deploy goal against local file system snapshotRepository in distributionManagement)

2)      Running “rebuild metadata” task in Nexus OSS 2.0.0 generates maven-metadata.xml with <latest/> property set

3)      Subsequent ‘maven deploy’ uploads do NOT alter <latest/> field (perhaps because mvn does not expect it to be present – since it’s not generated in #1)

From the above, a catch-22 situation: if one ever runs ‘rebuild metadata’ task in Nexus, <latest/> property is introduced (by Nexus) - but is never subsequently updated by ‘mvn deploy’. So, it seems, either one must:

1) never run ‘rebuild metadata’ (to never set <latest/> property) OR

2) one must always trigger that task every time a different version of SNAPSHOT artifact is uploaded via ‘mvn deploy’ (to keep <latest/> property updated)

I suppose I can achieve #2 via post-deploy call to nexus API, but is the above really by design? If not, which party (maven-deploy-plugin or Nexus ‘rebuild metadata’) should be behaving differently? Or am I missing something
else?

Thank you,

-nikita

From: Stuart McCulloch [mailto:[hidden email]

Sent: Thursday, March 22, 2012 7:44 AM

To: [hidden email]

Subject: Re: [nexus-user] nexus REST API /artifact/maven/[resolve|redirect] returns unexpected for v=LATEST

On 22 Mar 2012, at 11:48, Nikita Tovstoles wrote:

Update: I observed the following:

·         Running ‘rebuild metadata’ on repository from nexus UI fixes the problem – specifically API responds to v=LATEST with newest
version (11-SNAPSHOT in the case below)

·         The only change to maven-metadata.xml from the above is: <latest/> updated from 10-SNAPSHOT to 11-SNAPSHOT. So ‘latest’ does
matter for non-plugin artifacts – contrary to the FAQ (http://bit.ly/GEurFo )?

·         The cycle repeats, however – after newer 12-SNAPSHOT is published, maven-metadata.xml still lists 11-SNAPSHOT as <latest/> (albeit
listing lastUpdated matching 12-SNAPSHOT) and Nexus API responds with 11-SNAPSHOT when asked for ‘v=LATEST’

So, seems like one of the following must be true:

1)      Mvn deploy uploads incorrect maven-metadata.xml (and <latest/> does matter)

a.       I ran mvn deploy against a local file repo, and the resulting maven-metadata.xml did not have <latest/> property at all (using
mvn 3.0.4 and maven-deploy-plugin 2.7)

2)      Nexus does something to maven-metadata.xml on upload and the resulting file has wrong <latest/>

3)      <latest/> is indeed irrelevant and Nexus REST API returns wrong version for some other reason (can Nexus API be caching a response?)

Nexus only modifies the Maven metadata for a given repository when you explicitly ask to rebuild it, otherwise it is left to Maven to update.

However, Maven no longer updates the LATEST tag on deploy, see http://jira.codehaus.org/browse/MDEPLOY-103 and its linked issues.

From: Nikita Tovstoles [hidden email] 

Sent: Tuesday, March 20, 2012 5:25 PM

To: [hidden email]

Subject: [nexus-user] nexus REST API /artifact/maven/[resolve|redirect] returns unexpected for v=LATEST

Novice nexus oss (2.0.0) user here – getting unexpected results when requesting v=LATEST artifact from our hosted repo. I am hoping someone could explain what is wrong with our maven-metadata.xml (or my expectations of what v=LATEST returns). We have an
non-plugin JAR artifact “castanealabs-config” in Snapshots repo (published via maven-deploy-plugin, fwiw). The two most recent versions are 10-SNAPSHOT and 11-SNAPSHOT. The latter was published most recently (and has the highest version by maven convention,
as I understand it). Yet Nexus REST API (/artifact/maven/{resolve,redirect}) keeps returning most recent snapshot of 10-SNAPSHOT instead when asked for v=LATEST.

Why?

What inputs (from maven-metadata.xml at /group/artifact/maven-metadata.xml) does API evaluate to arrive at 10-SNAPSHOT. API responses below; attached are  maven-metadata.xml  files for:

1)      10-SNAPSHOT

2)      11-SNAPSHOT

3)      artifact

Notice that in artifact’s maven-metadata.xml lastUpdated matches the timestamp of 11-SNAPSHOT. From reading Nexus FAQ, my understanding is that versioning/latest attribute in that file is irrelevant since this is a non-plugin artifact.

Thank you,

-nikita

Asking /resolve for ‘v=LATEST’:

HTTP/1.1 200 OK

Date: Tue, 20 Mar 2012 22:08:19 GMT

Set-Cookie: rememberMe=deleteMe; Path=/nexus; Max-Age=0; Expires=Mon, 19-Mar-2012 22:08:19 GMT

Content-Type: application/xml; charset=UTF-8

Date: Tue, 20 Mar 2012 22:08:19 GMT

Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept

Server: Noelios-Restlet-Engine/1.1.6-SONATYPE-5348-V4

Content-Length: 638

<artifact-resolution>

<data>

<presentLocally>true</presentLocally>

<groupId>com.castanealabs</groupId>

<artifactId>castanealabs-config</artifactId>

    <version>10-20120320.074835-5</version>

    <baseVersion>10-SNAPSHOT</baseVersion>

<extension>jar</extension>

<snapshot>true</snapshot>

<snapshotBuildNumber>5</snapshotBuildNumber>

    <snapshotTimeStamp>1332229715000</snapshotTimeStamp>

<sha1>f107b5dd710dc3dbac8029ecb3f394b265e7c078</sha1>

<repositoryPath>/com/castanealabs/castanealabs-config/10-SNAPSHOT/castanealabs-config-10-20120320.074835-5.jar</repositoryPath>

</data>

</artifact-resolution>

Now ask for 11-SNAPSHOT explicitly – notice more recent <version/>:

HTTP/1.1 200 OK

Date: Tue, 20 Mar 2012 22:12:48 GMT

Set-Cookie: rememberMe=deleteMe; Path=/nexus; Max-Age=0; Expires=Mon, 19-Mar-2012 22:12:48 GMT

Content-Type: application/xml; charset=UTF-8

Date: Tue, 20 Mar 2012 22:12:48 GMT

Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept

Server: Noelios-Restlet-Engine/1.1.6-SONATYPE-5348-V4

Content-Length: 638

<artifact-resolution>

<data>

<presentLocally>true</presentLocally>

<groupId>com.castanealabs</groupId>

<artifactId>castanealabs-config</artifactId>

    <version>11-20120320.181629-2</version>

    <baseVersion>11-SNAPSHOT</baseVersion>

<extension>jar</extension>

<snapshot>true</snapshot>

<snapshotBuildNumber>2</snapshotBuildNumber>

    <snapshotTimeStamp>1332267389000</snapshotTimeStamp>

<sha1>d90c05740d587ae57fddd2318fc40258104283e2</sha1>

<repositoryPath>/com/castanealabs/castanealabs-config/11-SNAPSHOT/castanealabs-config-11-20120320.181629-2.jar</repositoryPath>

</data>

</artifact-resolution>

Maven-metadata.xml at /group/artifact/ level:

<?xml version="1.0" encoding="UTF-8"?>

<metadata>

<groupId>com.castanealabs</groupId>

<artifactId>castanealabs-config</artifactId>

<versioning>

<latest>10-SNAPSHOT</latest>

<release></release>

<versions>

<version>1.0-SNAPSHOT</version>

<version>7-SNAPSHOT</version>

<version>8-SNAPSHOT</version>

<version>10-SNAPSHOT</version>

<version>11-SNAPSHOT</version>

</versions>

<lastUpdated>20120320181629</lastUpdated>

</versioning>

</metadata>

Reply | Threaded |   

Re: nexus REST API /artifact/maven/[resolve|redirect] returns unexpected for v=LATEST

<base href="x-msg://11/">With regards to your rebuilding metadata...  you really shouldn't run this unless you have a good reason to.   Maven is responsible for maintaining the metadata files, rebuilding them should be thought of as
a "repair" operation.


Regarding Nexus setting "latest" after metadata rebuild, are these timestamped snapshots, or non-timestamped snapshots?  

Rich


On Mar 22, 2012, at 5:52 PM, Nikita Tovstoles wrote:
Thanks for the tip, Stuart. I think I understand what’s happening but do have a “am I ”:
 
1)      I see that artifact maven-metadata.xml, generated by deploy goal  (Mvn 3.0.4 and maven-deploy-plugin  2.7) does NOT contain <latest/> property at all – and understand
that the file is unaltered when uploaded to nexus repo. (I verified by running deploy goal against local file system snapshotRepository in distributionManagement)
2)      Running “rebuild metadata” task in Nexus OSS 2.0.0 generates maven-metadata.xml with <latest/> property set
3)      Subsequent ‘maven deploy’ uploads do NOT alter <latest/> field (perhaps because mvn does not expect it to be present – since it’s not generated in #1)
 
From the above, a catch-22 situation: if one ever runs ‘rebuild metadata’ task in Nexus, <latest/> property is introduced (by Nexus) - but is never subsequently updated by ‘mvn deploy’. So, it seems, either one must:

1) never run ‘rebuild metadata’ (to never set <latest/> property) OR
2) one must always trigger that task every time a different version of SNAPSHOT artifact is uploaded via ‘mvn deploy’ (to keep <latest/> property updated)
 
I suppose I can achieve #2 via post-deploy call to nexus API, but is the above really by design? If not, which party (maven-deploy-plugin or Nexus ‘rebuild metadata’) should be behaving differently? Or am I missing something
else?
 
Thank you,
-nikita
 
From: Stuart McCulloch [mailto:[hidden email]

Sent: Thursday, March 22, 2012 7:44 AM

To: [hidden email]

Subject: Re: [nexus-user] nexus REST API /artifact/maven/[resolve|redirect] returns unexpected for v=LATEST
 
On 22 Mar 2012, at 11:48, Nikita Tovstoles wrote:



Update: I observed the following:
·         Running ‘rebuild metadata’ on repository from nexus UI fixes the problem – specifically API responds to v=LATEST with newest
version (11-SNAPSHOT in the case below)
·         The only change to maven-metadata.xml from the above is: <latest/> updated from 10-SNAPSHOT to 11-SNAPSHOT. So ‘latest’ does
matter for non-plugin artifacts – contrary to the FAQ (http://bit.ly/GEurFo )?
·         The cycle repeats, however – after newer 12-SNAPSHOT is published, maven-metadata.xml still lists 11-SNAPSHOT as <latest/>
(albeit listing lastUpdated matching 12-SNAPSHOT) and Nexus API responds with 11-SNAPSHOT when asked for ‘v=LATEST’
 
So, seems like one of the following must be true:
1)      Mvn deploy uploads incorrect maven-metadata.xml (and <latest/> does matter)
a.       I ran mvn deploy against a local file repo, and the resulting maven-metadata.xml did not have <latest/> property at all (using
mvn 3.0.4 and maven-deploy-plugin 2.7)
2)      Nexus does something to maven-metadata.xml on upload and the resulting file has wrong <latest/>
3)      <latest/> is indeed irrelevant and Nexus REST API returns wrong version for some other reason (can Nexus API be caching a response?)
 
 
Nexus only modifies the Maven metadata for a given repository when you explicitly ask to rebuild it, otherwise it is left to Maven to update.
 
However, Maven no longer updates the LATEST tag on deploy, see http://jira.codehaus.org/browse/MDEPLOY-103 and its linked issues.



 
 
From: Nikita Tovstoles [hidden email] 

Sent: Tuesday, March 20, 2012 5:25 PM

To: [hidden email]

Subject: [nexus-user] nexus REST API /artifact/maven/[resolve|redirect] returns unexpected for v=LATEST
 
Novice nexus oss (2.0.0) user here – getting unexpected results when requesting v=LATEST artifact from our hosted repo. I am hoping someone could explain what is wrong with our maven-metadata.xml (or my expectations of what v=LATEST returns). We have an
non-plugin JAR artifact “castanealabs-config” in Snapshots repo (published via maven-deploy-plugin, fwiw). The two most recent versions are 10-SNAPSHOT and 11-SNAPSHOT. The latter was published most recently (and has the highest version by maven convention,
as I understand it). Yet Nexus REST API (/artifact/maven/{resolve,redirect}) keeps returning most recent snapshot of 10-SNAPSHOT instead when asked for v=LATEST.
 
Why?
What inputs (from maven-metadata.xml at /group/artifact/maven-metadata.xml) does API evaluate to arrive at 10-SNAPSHOT. API responses below; attached are  maven-metadata.xml  files for:
1)      10-SNAPSHOT
2)      11-SNAPSHOT
3)      artifact
 
Notice that in artifact’s maven-metadata.xml lastUpdated matches the timestamp of 11-SNAPSHOT. From reading Nexus FAQ, my understanding is that versioning/latest attribute in that file is irrelevant since this is a non-plugin artifact.
 
Thank you,
-nikita
 
Asking /resolve for ‘v=LATEST’:
 
HTTP/1.1 200 OK
Date: Tue, 20 Mar 2012 22:08:19 GMT
Set-Cookie: rememberMe=deleteMe; Path=/nexus; Max-Age=0; Expires=Mon, 19-Mar-2012 22:08:19 GMT
Content-Type: application/xml; charset=UTF-8
Date: Tue, 20 Mar 2012 22:08:19 GMT
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Server: Noelios-Restlet-Engine/1.1.6-SONATYPE-5348-V4
Content-Length: 638
 
<artifact-resolution>
  <data>
    <presentLocally>true</presentLocally>
    <groupId>com.castanealabs</groupId>
    <artifactId>castanealabs-config</artifactId>
    <version>10-20120320.074835-5</version>
    <baseVersion>10-SNAPSHOT</baseVersion>
    <extension>jar</extension>
    <snapshot>true</snapshot>
    <snapshotBuildNumber>5</snapshotBuildNumber>
    <snapshotTimeStamp>1332229715000</snapshotTimeStamp>
    <sha1>f107b5dd710dc3dbac8029ecb3f394b265e7c078</sha1>
    <repositoryPath>/com/castanealabs/castanealabs-config/10-SNAPSHOT/castanealabs-config-10-20120320.074835-5.jar</repositoryPath>
  </data>
</artifact-resolution>
 
Now ask for 11-SNAPSHOT explicitly – notice more

nexus REST API /artifact/maven/[resolve|redirect] returns unexpected for v=LATEST的更多相关文章

  1. Nexus 私有仓库搭建与 Maven 集成

    Nexus 私有仓库搭建与 Maven 集成 |作者:RexFang |出处:http://www.cnblogs.com/rexfang/ |关于作者:Java 程序员一枚 |版权:本文版权归作者和 ...

  2. 用nexus搭建自己的maven私有仓库

    用nexus搭建自己的maven私有仓库  刚安装nexus时,nexus启动失败,启动不到1分钟,自动停止.后来查找到了原因: Java 6 Support EOLOracle's support ...

  3. org.gradle.api.publication.maven.internal.DefaultMavenFactory错误

    Error:Unable to load class 'org.gradle.api.publication.maven.internal.DefaultMavenFactory'. Possible ...

  4. nexus 配置文件到本地maven本地仓库 失败

    Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on p ...

  5. Maven错误Failed to read artifact descriptor for xxx:jar 和 missing artifact maven dependency

    可参考:http://stackoverflow.com/questions/6111408/maven2-missing-artifact-but-jars-are-in-place http:// ...

  6. Error:Cause: org/gradle/api/publication/maven/internal/DefaultMavenFactory 解决办法

    当你使用的Gradle版本是2.4以上,Android插件版本是1.3.0以上的时候就会出现这个问题,这时候你只需将android-maven-gradle-plugin插件版本改为classpath ...

  7. Maven实战(十)利用 Nexus 来构建企业级 Maven 仓库

    目录 一.简介 Nexus是Maven仓库管理器,用来搭建一个本地仓库服务器,这样做的好处是便于管理,节省网络资源,速度快,还有一个非常有用的功能就是可以通过项目的SNAPSHOT版本管理,来进行模块 ...

  8. nexus 的使用及maven的配置

    一.nexus的安装 1.下载nexus(点解这里) 2.下载后解压文件,将解压后的nexus文件放在你自己想要的地方 3.配置环境变量(和配置java的环境变量一样) 4.安装和启动nexus 由于 ...

  9. nexus私服搭建及maven生命周期

    一.maven找库流程 从流程上看创建nexus私服,能够优化流程,而且更加快速 二.nexus下载.安装 1.nexus下载地址 https://sonatype-download.global.s ...

随机推荐

  1. Win32下C++遍历目录和文件的源码

    #include<windows.h> #include<iostream> #include<string> using namespace std; //只能处 ...

  2. 关于Oracle将小于1的数字to_char后丢掉0的解决办法

    SQL代码如下: select rtrim(to_char(0.11, 'fm9990.99'), '.') from dual;其中0.11为需要to_char的数字fm去掉字符串前面的空格9990 ...

  3. BZOJ 2301: [HAOI2011]Problem b( 数论 )

    和POI某道题是一样的...  http://www.cnblogs.com/JSZX11556/p/4686674.html 只需要二维差分一下就行了. 时间复杂度O(MAXN + N^1.5) - ...

  4. python request模块学习

    安装: pip install requests 使用: import requests HTTP请求:GET.POST.PUT.DELETE.HEAD.OPTIONS 1) get res = re ...

  5. 用while判断输入的数字是否回文数

    /* Name:用while判断输入的数字是否回文数 Copyright: By.不懂网络 Author: Yangbin Date:2014年2月18日 04:29:07 Description:用 ...

  6. 完美解决CTRL+空格不能切换中/英文输入法的问题

    首先任务栏上的输入法图标上点右键选择设置. 然后选择键设置,双击第一个“在不同的输入语言之间切换”先勾选“切换输入语言”下面选择左手ALT.取消右边“切换键盘布局”前的勾. 然后进入“中文(简体)输入 ...

  7. Windows下如何建立以"."开头的文件夹

    Windows资源管理器不允许创建点开头的文件或文件夹,但在cmd命令提示符下是可以的: 创建命令: md d:\.myfolder .myfolder就是以点开头的文件夹的名称

  8. [置顶] js模板方法的思路及实现

    在js中如何实现设计模式中的模板方法? 思路的产生必然要求熟悉js,如何实现?就很简单了,都知道在js中如果定义两个相同名称的方法,前一个方法就会被后一个方法覆盖掉,使用此特点就可以实现模板方法. 例 ...

  9. android项目 之 记事本(12) ----- 图片的等比例缩放及给图片加入边框

    本文是自己学习所做笔记.欢迎转载,但请注明出处:http://blog.csdn.net/jesson20121020 在Android的UI开发中常常会遇到图片的缩放,就比方记事本,如今的图片都比較 ...

  10. Android 动画animation 深入分析

    转载请注明出处:http://blog.csdn.net/farmer_cc/article/details/18259117 Android 动画animation 深入分析 前言:本文试图通过分析 ...