maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/transform SnapshotTransformation.java
Date Wed, 30 Mar 2005 01:17:34 GMT
brett       2005/03/29 17:17:34

  Modified:    maven-artifact/src/main/java/org/apache/maven/artifact/manager
                        DefaultWagonManager.java
               maven-artifact/src/main/java/org/apache/maven/artifact/transform
                        SnapshotTransformation.java
  Log:
  improve reporting
  
  Revision  Changes    Path
  1.24      +5 -4      maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
  
  Index: DefaultWagonManager.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- DefaultWagonManager.java	24 Mar 2005 14:52:25 -0000	1.23
  +++ DefaultWagonManager.java	30 Mar 2005 01:17:34 -0000	1.24
  @@ -211,7 +211,7 @@
               throw new TransferFailedException( "Failed to determine path for artifact",
e );
           }
   
  -        getRemoteFile( repository, destination, remotePath );
  +        getRemoteFile( repository, destination, remotePath, downloadMonitor );
       }
   
       public void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository remoteRepository,
File destination )
  @@ -228,10 +228,12 @@
               throw new TransferFailedException( "Failed to determine path for artifact",
e );
           }
   
  -        getRemoteFile( remoteRepository, destination, remotePath );
  +        // TODO: maybe some other listener that still notifies when metadata is being retrieved?
  +        getRemoteFile( remoteRepository, destination, remotePath, null );
       }
   
  -    private void getRemoteFile( ArtifactRepository repository, File destination, String
remotePath )
  +    private void getRemoteFile( ArtifactRepository repository, File destination, String
remotePath,
  +                                TransferListener downloadMonitor )
           throws TransferFailedException, ResourceDoesNotExistException
       {
           Wagon wagon;
  @@ -255,7 +257,6 @@
   
           //wagon.addTransferListener( md5SumObserver );
   
  -        // TODO: probably don't want this on metadata...
           if ( downloadMonitor != null )
           {
               wagon.addTransferListener( downloadMonitor );
  
  
  
  1.12      +24 -10    maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/transform/SnapshotTransformation.java
  
  Index: SnapshotTransformation.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/transform/SnapshotTransformation.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SnapshotTransformation.java	29 Mar 2005 16:41:13 -0000	1.11
  +++ SnapshotTransformation.java	30 Mar 2005 01:17:34 -0000	1.12
  @@ -22,6 +22,7 @@
   import org.apache.maven.artifact.metadata.SnapshotArtifactMetadata;
   import org.apache.maven.artifact.repository.ArtifactRepository;
   import org.apache.maven.artifact.repository.layout.ArtifactPathFormatException;
  +import org.codehaus.plexus.logging.AbstractLogEnabled;
   
   import java.io.IOException;
   import java.util.HashSet;
  @@ -36,6 +37,7 @@
    *          jvanzyl Exp $
    */
   public class SnapshotTransformation
  +    extends AbstractLogEnabled
       implements ArtifactTransformation
   {
       private WagonManager wagonManager;
  @@ -69,6 +71,7 @@
                   throw new ArtifactMetadataRetrievalException( "Error reading local metadata",
e );
               }
   
  +            String version = localMetadata.constructVersion();
               if ( !alreadyResolved( artifact ) )
               {
                   boolean foundRemote = false;
  @@ -76,12 +79,14 @@
                   {
                       ArtifactRepository remoteRepository = (ArtifactRepository) i.next();
   
  +                    getLogger().info(
  +                        artifact.getArtifactId() + ": checking for updates from " + remoteRepository.getId()
);
  +
                       SnapshotArtifactMetadata remoteMetadata = SnapshotArtifactMetadata.retrieveFromRemoteRepository(
                           artifact, remoteRepository, wagonManager );
   
                       if ( remoteMetadata.compareTo( localMetadata ) > 0 )
                       {
  -                        // TODO: investigate transforming this in place, in which case
resolve can return void
                           artifact.setRepository( remoteRepository );
   
                           localMetadata = remoteMetadata;
  @@ -94,9 +99,26 @@
                       artifact.addMetadata( localMetadata );
                   }
   
  +                if ( getLogger().isInfoEnabled() )
  +                {
  +                    if ( !version.equals( artifact.getBaseVersion() ) )
  +                    {
  +                        String message = artifact.getArtifactId() + ": resolved to version
" + version;
  +                        if ( foundRemote )
  +                        {
  +                            message += " from repository " + artifact.getRepository().getId();
  +                        }
  +                        else
  +                        {
  +                            message += " from local repository";
  +                        }
  +                        getLogger().info( message );
  +                    }
  +                }
  +
                   resolvedArtifactCache.add( getCacheKey( artifact ) );
               }
  -            artifact.setVersion( localMetadata.constructVersion() );
  +            artifact.setVersion( version );
           }
       }
   
  @@ -114,14 +136,6 @@
       public void transformForInstall( Artifact artifact, ArtifactRepository localRepository
)
       {
           // Nothing to do
  -/* TODO: remove
  -        if ( isSnapshot( artifact ) )
  -        {
  -            // only store the version-local.txt file for POMs as every file has an associated
POM
  -            ArtifactMetadata metadata = SnapshotArtifactMetadata.createLocalSnapshotMetadata(
artifact );
  -            artifact.addMetadata( metadata );
  -        }
  -*/
       }
   
       public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository
)
  
  
  

Mime
View raw message