You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Karl Heinz Marbaise <kh...@gmx.de> on 2016/08/06 11:19:07 UTC

Question Artifacts in local cache

Hi,

If I do a mvn install with a project all artifacts are being installed 
into my local cache..


The question I have:

Can I somehow identify if an artifact is already been in my local cache 
or not (within a Maven plugin or extension)?

Something like:

if (artifact is in local cache) {
    Do...
}
else
{
    Do something different..
}

If I can check it somehow, can I furthermore check how long the 
artifacts has been there  based on the update policy ? So can i see ok 
this artifact has been there since yesterday so it would make sense to 
update it? (I assume based on modification date simply?)...

Furthermore is there a way to prevent downloading from remote repos if 
the artifact is not in my local cache?


Kind regards
Karl Heinz Marbaise

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


Re: Question Artifacts in local cache

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi Robert,

On 8/6/16 3:42 PM, Robert Scholte wrote:
> Hi Karl Heinz,
>
> I think what you should do is add -am and maybe even -amd to the
> arguments. There should be no reason to run mvn install, even when using
> the incremental module builder.

The more I'm thinking about this I come to the conclusion that you are 
right...

-amd is currently what is implemented...About -am I need to think about...

Kind regards
Karl Heinz

>
> Robert
>
> On Sat, 06 Aug 2016 15:38:44 +0200, Karl Heinz Marbaise
> <kh...@gmx.de> wrote:
>
>> Hi Robert,
>>
>> On 8/6/16 3:22 PM, Robert Scholte wrote:
>>> Hi Karl Heinz,
>>>
>>> This all sounds like repository policies[1], so something that should be
>>> part of Aether.
>>> Disabling such repositories should prevent them from downloading.
>>> (assuming --offline is not an option)
>>> From a plugin of MavenProject point of view I'm not interested in the
>>> logic behind it: either give me the artifacts or break the build if
>>> they're not available.
>>> I assume you're looking for some like timeToLive as an option for a
>>> SNAPSHOT repository. Might be interesting to add that to the
>>> settings.xml. Be aware that the repository also contains metadata, so
>>> simply removing an artifact doesn't sounds like a good approach. Instead
>>> there should be a very clear Exception that you cannot download a fresh
>>> SNAPSHOT even though there are still versions available in the local
>>> repo.
>>
>> My use case is in my incremental module builder to identify
>> automatically if a user has made the initial "mvn install" (which is
>> needed at the moment or using the SNAPSHOT's from remote repository)
>> ...if not i could say and end with an appropriate error message...
>>
>> But I'm not sure if this is a good idea to limit it in that way ? Or
>> just let the user decide to run mvn install or not ?
>>
>> May be I'm on the wrong path...
>>
>> Need to think about that a little bit more...
>>
>> Thanks for your answer...
>>
>>
>>>
>>> thanks,
>>> Robert
>>> [1]
>>> https://maven.apache.org/ref/3.3.9/maven-settings/settings.html#class_repository
>>>
>>>
>>>
>>> On Sat, 06 Aug 2016 13:19:07 +0200, Karl Heinz Marbaise
>>> <kh...@gmx.de> wrote:
>>>
>>>> Hi,
>>>>
>>>> If I do a mvn install with a project all artifacts are being installed
>>>> into my local cache..
>>>>
>>>>
>>>> The question I have:
>>>>
>>>> Can I somehow identify if an artifact is already been in my local
>>>> cache or not (within a Maven plugin or extension)?
>>>>
>>>> Something like:
>>>>
>>>> if (artifact is in local cache) {
>>>>     Do...
>>>> }
>>>> else
>>>> {
>>>>     Do something different..
>>>> }
>>>>
>>>> If I can check it somehow, can I furthermore check how long the
>>>> artifacts has been there  based on the update policy ? So can i see ok
>>>> this artifact has been there since yesterday so it would make sense to
>>>> update it? (I assume based on modification date simply?)...
>>>>
>>>> Furthermore is there a way to prevent downloading from remote repos if
>>>> the artifact is not in my local cache?
>>>>

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


Re: Question Artifacts in local cache

Posted by Robert Scholte <rf...@apache.org>.
Hi Karl Heinz,

I think what you should do is add -am and maybe even -amd to the  
arguments. There should be no reason to run mvn install, even when using  
the incremental module builder.

Robert

On Sat, 06 Aug 2016 15:38:44 +0200, Karl Heinz Marbaise  
<kh...@gmx.de> wrote:

> Hi Robert,
>
> On 8/6/16 3:22 PM, Robert Scholte wrote:
>> Hi Karl Heinz,
>>
>> This all sounds like repository policies[1], so something that should be
>> part of Aether.
>> Disabling such repositories should prevent them from downloading.
>> (assuming --offline is not an option)
>> From a plugin of MavenProject point of view I'm not interested in the
>> logic behind it: either give me the artifacts or break the build if
>> they're not available.
>> I assume you're looking for some like timeToLive as an option for a
>> SNAPSHOT repository. Might be interesting to add that to the
>> settings.xml. Be aware that the repository also contains metadata, so
>> simply removing an artifact doesn't sounds like a good approach. Instead
>> there should be a very clear Exception that you cannot download a fresh
>> SNAPSHOT even though there are still versions available in the local  
>> repo.
>
> My use case is in my incremental module builder to identify  
> automatically if a user has made the initial "mvn install" (which is  
> needed at the moment or using the SNAPSHOT's from remote repository)  
> ...if not i could say and end with an appropriate error message...
>
> But I'm not sure if this is a good idea to limit it in that way ? Or  
> just let the user decide to run mvn install or not ?
>
> May be I'm on the wrong path...
>
> Need to think about that a little bit more...
>
> Thanks for your answer...
>
>
>>
>> thanks,
>> Robert
>> [1]
>> https://maven.apache.org/ref/3.3.9/maven-settings/settings.html#class_repository
>>
>>
>> On Sat, 06 Aug 2016 13:19:07 +0200, Karl Heinz Marbaise
>> <kh...@gmx.de> wrote:
>>
>>> Hi,
>>>
>>> If I do a mvn install with a project all artifacts are being installed
>>> into my local cache..
>>>
>>>
>>> The question I have:
>>>
>>> Can I somehow identify if an artifact is already been in my local
>>> cache or not (within a Maven plugin or extension)?
>>>
>>> Something like:
>>>
>>> if (artifact is in local cache) {
>>>     Do...
>>> }
>>> else
>>> {
>>>     Do something different..
>>> }
>>>
>>> If I can check it somehow, can I furthermore check how long the
>>> artifacts has been there  based on the update policy ? So can i see ok
>>> this artifact has been there since yesterday so it would make sense to
>>> update it? (I assume based on modification date simply?)...
>>>
>>> Furthermore is there a way to prevent downloading from remote repos if
>>> the artifact is not in my local cache?
>>>
>>>
>>> Kind regards
>>> Karl Heinz Marbaise
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org

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


Re: Question Artifacts in local cache

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi Robert,

On 8/6/16 3:22 PM, Robert Scholte wrote:
> Hi Karl Heinz,
>
> This all sounds like repository policies[1], so something that should be
> part of Aether.
> Disabling such repositories should prevent them from downloading.
> (assuming --offline is not an option)
> From a plugin of MavenProject point of view I'm not interested in the
> logic behind it: either give me the artifacts or break the build if
> they're not available.
> I assume you're looking for some like timeToLive as an option for a
> SNAPSHOT repository. Might be interesting to add that to the
> settings.xml. Be aware that the repository also contains metadata, so
> simply removing an artifact doesn't sounds like a good approach. Instead
> there should be a very clear Exception that you cannot download a fresh
> SNAPSHOT even though there are still versions available in the local repo.

My use case is in my incremental module builder to identify 
automatically if a user has made the initial "mvn install" (which is 
needed at the moment or using the SNAPSHOT's from remote repository) 
...if not i could say and end with an appropriate error message...

But I'm not sure if this is a good idea to limit it in that way ? Or 
just let the user decide to run mvn install or not ?

May be I'm on the wrong path...

Need to think about that a little bit more...

Thanks for your answer...


>
> thanks,
> Robert
> [1]
> https://maven.apache.org/ref/3.3.9/maven-settings/settings.html#class_repository
>
>
> On Sat, 06 Aug 2016 13:19:07 +0200, Karl Heinz Marbaise
> <kh...@gmx.de> wrote:
>
>> Hi,
>>
>> If I do a mvn install with a project all artifacts are being installed
>> into my local cache..
>>
>>
>> The question I have:
>>
>> Can I somehow identify if an artifact is already been in my local
>> cache or not (within a Maven plugin or extension)?
>>
>> Something like:
>>
>> if (artifact is in local cache) {
>>     Do...
>> }
>> else
>> {
>>     Do something different..
>> }
>>
>> If I can check it somehow, can I furthermore check how long the
>> artifacts has been there  based on the update policy ? So can i see ok
>> this artifact has been there since yesterday so it would make sense to
>> update it? (I assume based on modification date simply?)...
>>
>> Furthermore is there a way to prevent downloading from remote repos if
>> the artifact is not in my local cache?
>>
>>
>> Kind regards
>> Karl Heinz Marbaise

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


Re: Question Artifacts in local cache

Posted by Robert Scholte <rf...@apache.org>.
Hi Karl Heinz,

This all sounds like repository policies[1], so something that should be  
part of Aether.
Disabling such repositories should prevent them from downloading.  
(assuming --offline is not an option)
 From a plugin of MavenProject point of view I'm not interested in the  
logic behind it: either give me the artifacts or break the build if  
they're not available.
I assume you're looking for some like timeToLive as an option for a  
SNAPSHOT repository. Might be interesting to add that to the settings.xml.  
Be aware that the repository also contains metadata, so simply removing an  
artifact doesn't sounds like a good approach. Instead there should be a  
very clear Exception that you cannot download a fresh SNAPSHOT even though  
there are still versions available in the local repo.

thanks,
Robert
[1]  
https://maven.apache.org/ref/3.3.9/maven-settings/settings.html#class_repository

On Sat, 06 Aug 2016 13:19:07 +0200, Karl Heinz Marbaise  
<kh...@gmx.de> wrote:

> Hi,
>
> If I do a mvn install with a project all artifacts are being installed  
> into my local cache..
>
>
> The question I have:
>
> Can I somehow identify if an artifact is already been in my local cache  
> or not (within a Maven plugin or extension)?
>
> Something like:
>
> if (artifact is in local cache) {
>     Do...
> }
> else
> {
>     Do something different..
> }
>
> If I can check it somehow, can I furthermore check how long the  
> artifacts has been there  based on the update policy ? So can i see ok  
> this artifact has been there since yesterday so it would make sense to  
> update it? (I assume based on modification date simply?)...
>
> Furthermore is there a way to prevent downloading from remote repos if  
> the artifact is not in my local cache?
>
>
> Kind regards
> Karl Heinz Marbaise
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org

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