You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by cowwoc <co...@bbs.darktech.org> on 2011/01/26 20:48:31 UTC

Checking if an artifact exists in the local repository

Hi,

How do I check from within a Mojo if an artifact already exists in the local
repository?

I'm installing large binaries into the local Maven repository and I need to
know if they already exist before attempting to download them.

Thanks,
Gili
-- 
View this message in context: http://maven.40175.n5.nabble.com/Checking-if-an-artifact-exists-in-the-local-repository-tp3358513p3358513.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Checking if an artifact exists in the local repository

Posted by cowwoc <co...@bbs.darktech.org>.

cowwoc wrote:
> 
> Hi,
> 
> How do I check from within a Mojo if an artifact already exists in the
> local repository?
> 
> I'm installing large binaries into the local Maven repository and I need
> to know if they already exist before attempting to download them.
> 
> Thanks,
> Gili
> 

Nevermind. Got it:
http://stackoverflow.com/questions/4809238/maven-how-to-check-if-an-artifact-exists

Gili
-- 
View this message in context: http://maven.40175.n5.nabble.com/Checking-if-an-artifact-exists-in-the-local-repository-tp3358513p3358615.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Checking if an artifact exists in the local repository

Posted by cowwoc <co...@bbs.darktech.org>.

     I ended up checking file sizes as you suggested.

Thanks,
Gili

On 26/01/2011 4:04 PM, stephenconnolly [via Maven] wrote:
> up to you, but if I was downloading large stuff from non maven 
> repositories,
> I'd add checks for interrupted downloads.
>
> - Stephen
>
> ---
> Sent from my Android phone, so random spelling mistakes, random nonsense
> words and other nonsense are a direct result of using swype to type on 
> the
> screen
> On 26 Jan 2011 20:52, "cowwoc" <[hidden email] 
> </user/SendEmail.jtp?type=node&node=3358672&i=0>> wrote:
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://maven.40175.n5.nabble.com/Checking-if-an-artifact-exists-in-the-local-repository-tp3358513p3358672.html 
>
> To unsubscribe from Checking if an artifact exists in the local 
> repository, click here 
> <http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3358513&code=Y293d29jQGJicy5kYXJrdGVjaC5vcmd8MzM1ODUxM3wxNTc0MzIxMjQ3>. 
>


-- 
View this message in context: http://maven.40175.n5.nabble.com/Checking-if-an-artifact-exists-in-the-local-repository-tp3358513p3362149.html
Sent from the Maven - Users mailing list archive at Nabble.com.

Re: Checking if an artifact exists in the local repository

Posted by Stephen Connolly <st...@gmail.com>.
up to you, but if I was downloading large stuff from non maven repositories,
I'd add checks for interrupted downloads.

- Stephen

---
Sent from my Android phone, so random spelling mistakes, random nonsense
words and other nonsense are a direct result of using swype to type on the
screen
On 26 Jan 2011 20:52, "cowwoc" <co...@bbs.darktech.org> wrote:

Re: Checking if an artifact exists in the local repository

Posted by cowwoc <co...@bbs.darktech.org>.

stephenconnolly wrote:
> 
> you could try and resolve the file from the local repository and an empty
> set of remote repositories... if the file resolves, then I'd check the
> size
> and time stamp and only then decide what to do
> 

Thanks Stephen.

I'm going to forgo checking for timestamps in my case because I'm grabbing
files off sourceforge and (I assume) each mirror will use its own timestamp.

Regarding checking for size, is there really a need? Once someone makes an
official release (on Maven or SourceForge) don't we operate under the
assumption that it's immutable? Users can always delete artifacts from their
local repository in case of corruption but I think that is going to be
extremely rare. Am I wrong?

Gili
-- 
View this message in context: http://maven.40175.n5.nabble.com/Checking-if-an-artifact-exists-in-the-local-repository-tp3358513p3358617.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Checking if an artifact exists in the local repository

Posted by Stephen Connolly <st...@gmail.com>.
you could try and resolve the file from the local repository and an empty
set of remote repositories... if the file resolves, then I'd check the size
and time stamp and only then decide what to do

- Stephen

---
Sent from my Android phone, so random spelling mistakes, random nonsense
words and other nonsense are a direct result of using swype to type on the
screen
On 26 Jan 2011 19:49, "cowwoc" <co...@bbs.darktech.org> wrote: