You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Max Bowsher <ma...@mxtelecom.com> on 2006/09/04 12:47:14 UTC

Seeking help to understand maven-artifact-manager snapshot handling

Hi,

Attempting to debug MJAR-28 has led me to a section of code in:
org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve
which I would like to ask for some help understanding why it does what 
it does.

Here is the code chunk in question:

> if ( artifact.isSnapshot() && !artifact.getBaseVersion().equals( artifact.getVersion() ) )
> {
>     String version = artifact.getVersion();
>     artifact.selectVersion( artifact.getBaseVersion() );
>     File copy = new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) );
>     if ( resolved || !copy.exists() )
>     {
>         // recopy file if it was reresolved, or doesn't exist.
>         try
>         {
>             FileUtils.copyFile( destination, copy );
>         }
>         catch ( IOException e )
>         {
>             throw new ArtifactResolutionException(
>                 "Unable to copy resolved artifact for local use: " + e.getMessage(), artifact,
>                 remoteRepositories, e );
>         }
>     }
>     artifact.setFile( copy );
>     artifact.selectVersion( version );
> }

My questions are:

What is the canonical description of the difference between baseVersion 
and version?

Does this code chunk ever get used in cases other than when baseVersion 
contains "SNAPSHOT" and version contains a timestamped version?

Is there a good reason for setting the artifact's file to the 
baseVersion generated name, instead of the version generated name?

What is the purpose of making the copy - couldn't everything use the 
name of the file already existing?

Is it deliberate that at the end of this block, the artifact's 
baseVersion has been set to its version?


Thanks in advance to anyone who has the patience to answer - I realize 
that's a rather large list of questions.

-- 
Max Bowsher <ma...@mxtelecom.com>
http://www.mxtelecom.com

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


Re: Seeking help to understand maven-artifact-manager snapshot handling

Posted by Brett Porter <br...@apache.org>.
On 04/09/2006, at 8:47 PM, Max Bowsher wrote:

> What is the canonical description of the difference between  
> baseVersion and version?

baseVersion = 1.0-SNAPSHOT. version = 1.0-20060809.141516-1 (under  
uniqueVersion) or 1.0-SNAPSHOT (non-uniqueVersion, or locally  
installed). Similarly, for non-snapshots, baseVersion = version.

>
> Does this code chunk ever get used in cases other than when  
> baseVersion contains "SNAPSHOT" and version contains a timestamped  
> version?

No, because this sentence is exactly the first line of code written  
in English :)

>
> Is there a good reason for setting the artifact's file to the  
> baseVersion generated name, instead of the version generated name?
>
> What is the purpose of making the copy - couldn't everything use  
> the name of the file already existing?

To be honest, I can't remember and would need to look more closely at  
the code whether it is required.

>
> Is it deliberate that at the end of this block, the artifact's  
> baseVersion has been set to its version?

I think that's a bug, I've seen directories with the timestamp turn  
up in the local repository and was wondering where that came from.

>
>
> Thanks in advance to anyone who has the patience to answer - I  
> realize that's a rather large list of questions.
>
> -- 
> Max Bowsher <ma...@mxtelecom.com>
> http://www.mxtelecom.com
>
> ---------------------------------------------------------------------
> 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