You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Paul <pa...@nosphere.org> on 2008/11/07 15:14:51 UTC

Getting artifacts snapshot versions in a MOJO

I'm only changing the subject as I understand that it was completely 
unclear :)

Hello,

Since I've setup a CI server at my java shop we have snapshots autodeployed to 
our internal repo.

This is cool :) But as a side effect I see some artifacts being used in builds 
with snapshots versions (like foo-1.0.3-20081104.143523-57.jar). This is 
expected.

Regarding this I have one question. 

We use a home grown maven plugin that plays with project dependencies and 
detects if a dependency has a particular classifier attached. To do this it 
tries to download the eventually attached artifact for all dependencies of 
the project. Thanks to full featured maven repositories and good naming 
convention, we reduced the internal download request number a lot and the 
external download request number down to zero (using black/white listing).

My mojo gets the snapshot dependencies versions as X.X.X-SNAPSHOT and tries to 
download X.X.X-SNAPSHOT-classifier. It has happen that a snapshot version had 
the attached artifact but not another version of the same snapshot and my 
plugin fetched a wrong version of it.

It's a little bit hard to explain, if you don't get the idea I can 
reformulate :)

So, I would like to know how to get the "snapshot version" of a snapshot 
dependency in my mojo so I can use a precise version to trigger the download 
try.

Any help appreciated.

Paul

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


Re: Getting artifacts snapshot versions in a MOJO

Posted by Paul <pa...@nosphere.org>.
Le Friday 07 November 2008 15:44:01 Stephen Connolly, vous avez écrit :
> When you build foo-1.0.3-SNAPSHOT,
> the build treats that version as is until you reach the deploy stage.
>
> At deploy, the deploy plugin gives it the timestamp... so the timestamp is
> only available when you get to the deploy phase (i.e. after deploy you'd be
> able to get foo-1.0.3-20081104.143523-57)
>
> Unfortunately for you, you are looking for the value before it exists...
Understood, thanks Stephen.

> now if this is for a separate module, then you might stand a chance

To be more precise, when I'm building foo-1.0.3-SNAPSHOT, depending on 
bar-1.2.2-SNAPSHOT our MOJO tries to download bar-1.2.2-SNAPSHOT-aclassifier.

Given that at time 1, bar snapshot version was deployed _with_ an attached 
artifact with "aclassifier" and that at time 2 another bar snapshot version 
was deployed _without_ and attached artifact with "aclassifier", maven 
download the last snapshot version of bar-1.2.2-SNAPSHOT but our MOJO 
download the previous deployed snapshot version when trying to resolve 
bar-1.2.2-SNAPSHOT-aclassifier.

Any idea ?

Paul




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


Re: Getting artifacts snapshot versions in a MOJO

Posted by Stephen Connolly <st...@gmail.com>.
When you build foo-1.0.3-SNAPSHOT,
the build treats that version as is until you reach the deploy stage.

At deploy, the deploy plugin gives it the timestamp... so the timestamp is
only available when you get to the deploy phase (i.e. after deploy you'd be
able to get foo-1.0.3-20081104.143523-57)

Unfortunately for you, you are looking for the value before it exists...

now if this is for a separate module, then you might stand a chance

-Stephen

2008/11/7 Paul <pa...@nosphere.org>

> I'm only changing the subject as I understand that it was completely
> unclear :)
>
> Hello,
>
> Since I've setup a CI server at my java shop we have snapshots autodeployed
> to
> our internal repo.
>
> This is cool :) But as a side effect I see some artifacts being used in
> builds
> with snapshots versions (like foo-1.0.3-20081104.143523-57.jar). This is
> expected.
>
> Regarding this I have one question.
>
> We use a home grown maven plugin that plays with project dependencies and
> detects if a dependency has a particular classifier attached. To do this it
> tries to download the eventually attached artifact for all dependencies of
> the project. Thanks to full featured maven repositories and good naming
> convention, we reduced the internal download request number a lot and the
> external download request number down to zero (using black/white listing).
>
> My mojo gets the snapshot dependencies versions as X.X.X-SNAPSHOT and tries
> to
> download X.X.X-SNAPSHOT-classifier. It has happen that a snapshot version
> had
> the attached artifact but not another version of the same snapshot and my
> plugin fetched a wrong version of it.
>
> It's a little bit hard to explain, if you don't get the idea I can
> reformulate :)
>
> So, I would like to know how to get the "snapshot version" of a snapshot
> dependency in my mojo so I can use a precise version to trigger the
> download
> try.
>
> Any help appreciated.
>
> Paul
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>