maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aherit...@apache.org
Subject svn commit: r496548 - in /maven/maven-1/core/trunk/src: java/org/apache/maven/cli/ java/org/apache/maven/repository/ java/org/apache/maven/verifier/ messages/
Date Tue, 16 Jan 2007 00:19:57 GMT
Author: aheritier
Date: Mon Jan 15 16:19:56 2007
New Revision: 496548

URL: http://svn.apache.org/viewvc?view=rev&rev=496548
Log:
Update logs (Copy m2 format)
Improve dependency verifier

Modified:
    maven/maven-1/core/trunk/src/java/org/apache/maven/cli/App.java
    maven/maven-1/core/trunk/src/java/org/apache/maven/repository/AbstractArtifact.java
    maven/maven-1/core/trunk/src/java/org/apache/maven/repository/Artifact.java
    maven/maven-1/core/trunk/src/java/org/apache/maven/verifier/DependencyVerifier.java
    maven/maven-1/core/trunk/src/messages/messages.properties

Modified: maven/maven-1/core/trunk/src/java/org/apache/maven/cli/App.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/java/org/apache/maven/cli/App.java?view=diff&rev=496548&r1=496547&r2=496548
==============================================================================
--- maven/maven-1/core/trunk/src/java/org/apache/maven/cli/App.java (original)
+++ maven/maven-1/core/trunk/src/java/org/apache/maven/cli/App.java Mon Jan 15 16:19:56 2007
@@ -391,27 +391,21 @@
 
         if ( !failed )
         {
-            LOGGER.info( MavenUtils.getMessage( "build.successful" ) );
-        }
-
-        if ( LOGGER.isDebugEnabled() )
-        {
-            final long mb = 1024 * 1024;
-            System.gc();
-            Runtime r = Runtime.getRuntime();
-            LOGGER.debug( MavenUtils.getMessage( "build.final.memory", ( ( r.totalMemory()
- r.freeMemory() ) / mb )
-                + "M/" + ( r.totalMemory() / mb ) + "M" ) );
+            LOGGER.warn( MavenUtils.getMessage( "line" ) );
+            LOGGER.warn( MavenUtils.getMessage( "build.successful" ) );
         }
+        LOGGER.warn( MavenUtils.getMessage( "line" ) );
         Date fullStop = new Date();
         DateFormat defaultDate = DateFormat.getDateTimeInstance( DateFormat.FULL, DateFormat.LONG
);
-
         long fullDiff = fullStop.getTime() - fullStart.getTime();
-        LOGGER.info( "" );
-        LOGGER.info( MavenUtils.getMessage( "build.total.time", formatTime( fullDiff ) )
);
-        LOGGER.info( MavenUtils.getMessage( "build.finished.time", defaultDate.format( fullStop
) ) );
-
-        LOGGER.info( "" );
-
+        LOGGER.warn( MavenUtils.getMessage( "build.total.time", formatTime( fullDiff ) )
);
+        LOGGER.warn( MavenUtils.getMessage( "build.finished.time", defaultDate.format( fullStop
) ) );
+        final long mb = 1024 * 1024;
+        System.gc();
+        Runtime r = Runtime.getRuntime();
+        LOGGER.warn( MavenUtils.getMessage( "build.final.memory", ( ( r.totalMemory() - r.freeMemory()
) / mb ) + "M/"
+            + ( r.totalMemory() / mb ) + "M" ) );
+        LOGGER.warn( MavenUtils.getMessage( "line" ) );
         exit( returnCode );
     }
 
@@ -1267,9 +1261,9 @@
 
     private void displayBuildFailed()
     {
-        LOGGER.error( "" );
+        LOGGER.error( MavenUtils.getMessage( "line" ) );
         LOGGER.error( MavenUtils.getMessage( "build.failed" ) );
-        LOGGER.error( "" );
+        LOGGER.error( MavenUtils.getMessage( "line" ) );
         LOGGER.error( MavenUtils.getMessage( "build.errors.stack" ) );
 
     }

Modified: maven/maven-1/core/trunk/src/java/org/apache/maven/repository/AbstractArtifact.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/java/org/apache/maven/repository/AbstractArtifact.java?view=diff&rev=496548&r1=496547&r2=496548
==============================================================================
--- maven/maven-1/core/trunk/src/java/org/apache/maven/repository/AbstractArtifact.java (original)
+++ maven/maven-1/core/trunk/src/java/org/apache/maven/repository/AbstractArtifact.java Mon
Jan 15 16:19:56 2007
@@ -198,25 +198,20 @@
         this.overrideType = overrideType;
     }
 
-    /**
-     * @see java.lang.Object#toString()
+    /* (non-Javadoc)
+     * @see org.apache.maven.repository.Artifact#getDescription()
      */
-    public String toString()
+    public String getDescription()
     {
-        StringBuffer result = new StringBuffer();
-        result.append( getName() );
-        if ( dependency != null )
-        {
-            result.append( "( groupid = " );
-            result.append( getDependency().getGroupId() );
-            result.append( ", artifactid = " );
-            result.append( getDependency().getArtifactId() );
-            result.append( ", version = " );
-            result.append( getDependency().getVersion() );
-            result.append( ", type = " );
-            result.append( getDependency().getType() );
-            result.append( " )" );
-        }
-        return result.toString();
+        StringBuffer buffer = new StringBuffer();
+        buffer.append( getDependency().getGroupId() );
+        buffer.append( ":" );
+        buffer.append( getDependency().getArtifactId() );
+        buffer.append( ":" );
+        buffer.append( getDependency().getVersion() );
+        buffer.append( ":" );
+        buffer.append( getDependency().getType() );
+        return buffer.toString();
     }
+
 }

Modified: maven/maven-1/core/trunk/src/java/org/apache/maven/repository/Artifact.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/java/org/apache/maven/repository/Artifact.java?view=diff&rev=496548&r1=496547&r2=496548
==============================================================================
--- maven/maven-1/core/trunk/src/java/org/apache/maven/repository/Artifact.java (original)
+++ maven/maven-1/core/trunk/src/java/org/apache/maven/repository/Artifact.java Mon Jan 15
16:19:56 2007
@@ -128,4 +128,6 @@
     public void setOverrideType( String overrideType );
 
     public String getOverrideType();
+    
+    public String getDescription();
 }

Modified: maven/maven-1/core/trunk/src/java/org/apache/maven/verifier/DependencyVerifier.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/java/org/apache/maven/verifier/DependencyVerifier.java?view=diff&rev=496548&r1=496547&r2=496548
==============================================================================
--- maven/maven-1/core/trunk/src/java/org/apache/maven/verifier/DependencyVerifier.java (original)
+++ maven/maven-1/core/trunk/src/java/org/apache/maven/verifier/DependencyVerifier.java Mon
Jan 15 16:19:56 2007
@@ -79,6 +79,10 @@
 
     private static Set resolvedArtifacts = new HashSet();
 
+    private ProxyInfo proxyInfo = null;
+
+    private TransferListener listener = null;
+
     /**
      * Default ctor.
      * @param project the project to verify
@@ -88,6 +92,40 @@
         super( project );
         failedDependencies = new ArrayList();
         localRepositoryVerifier = new LocalSettingsVerifier( project );
+        MavenJellyContext context = getProject().getContext();
+
+        if ( context.getProxyHost() != null )
+        {
+            proxyInfo = new ProxyInfo();
+            proxyInfo.setHost( context.getProxyHost() );
+            try
+            {
+                proxyInfo.setPort( Integer.valueOf( context.getProxyPort() ).intValue() );
+            }
+            catch ( NumberFormatException e )
+            {
+                LOGGER.warn( "Ignoring invalid proxy port: '" + context.getProxyPort() +
"'" );
+            }
+            proxyInfo.setUserName( context.getProxyUserName() );
+            proxyInfo.setPassword( context.getProxyPassword() );
+            proxyInfo.setNonProxyHosts( (String) context.getVariable( MavenConstants.PROXY_NONPROXYHOSTS
) );
+            proxyInfo.setNtlmHost( (String) context.getVariable( MavenConstants.PROXY_NTLM_HOST
) );
+            proxyInfo.setNtlmDomain( (String) context.getVariable( MavenConstants.PROXY_NTLM_DOMAIN
) );
+        }
+        String meterType = (String) context.getVariable( MavenConstants.DOWNLOAD_METER );
+        if ( meterType == null )
+        {
+            meterType = "console";
+        }
+
+        if ( "bootstrap".equals( meterType ) )
+        {
+            listener = new BootstrapDownloadMeter();
+        }
+        else if ( "console".equals( meterType ) )
+        {
+            listener = new ConsoleDownloadMeter();
+        }
     }
 
     /**
@@ -110,10 +148,7 @@
      */
     private void clearFailedDependencies()
     {
-        for ( int i = 0; i < failedDependencies.size(); i++ )
-        {
-            failedDependencies.remove( i );
-        }
+        failedDependencies.clear();
     }
 
     /**
@@ -146,7 +181,8 @@
             String path = artifact.getUrlPath();
             if ( resolvedArtifacts.contains( path ) )
             {
-                LOGGER.debug( "(previously resolved: " + path + ")" );
+                if ( LOGGER.isDebugEnabled() )
+                    LOGGER.debug( "(previously resolved: " + path + ")" );
                 continue;
             }
             resolvedArtifacts.add( path );
@@ -154,7 +190,8 @@
             // The artifact plain doesn't exist so chalk it up as a failed dependency.
             if ( !artifact.exists() )
             {
-                LOGGER.debug( "Artifact [" + path + "] not found in local repository" );
+                if ( LOGGER.isDebugEnabled() )
+                    LOGGER.debug( "Artifact [" + path + "] not found in local repository"
);
                 failedDependencies.add( artifact );
             }
             else if ( artifact.isSnapshot() && !Artifact.OVERRIDE_PATH.equals( artifact.getOverrideType()
) )
@@ -214,12 +251,12 @@
             message.append( getMessage( "multiple.unsatisfied.dependency.error" ) );
         }
 
-        message.append( "\n\n" );
+        message.append( "\n" );
 
         for ( Iterator i = failedDependencies.iterator(); i.hasNext(); )
         {
             Artifact artifact = (Artifact) i.next();
-            message.append( artifact );
+            message.append( "- " + artifact.getDescription() );
 
             String overrideType = artifact.getOverrideType();
             if ( overrideType != Artifact.OVERRIDE_NONE )
@@ -254,7 +291,8 @@
     private void getDependencies()
         throws ChecksumVerificationException
     {
-        LOGGER.debug( "Getting failed dependencies: " + failedDependencies );
+        if ( LOGGER.isDebugEnabled() )
+            LOGGER.debug( "Getting failed dependencies: " + failedDependencies );
 
         // if there are failed dependencies try to indicate for which project:
         if ( failedDependencies.size() > 0 )
@@ -262,9 +300,11 @@
             LOGGER.info( getMessage( "satisfy.project.message", getProject().getName() )
);
         }
 
-        for ( Iterator i = failedDependencies.iterator(); i.hasNext(); )
+        Artifact artifact;
+        Iterator i = failedDependencies.iterator();
+        while ( i.hasNext() )
         {
-            Artifact artifact = (Artifact) i.next();
+            artifact = (Artifact) i.next();
 
             // before we try to download a missing dependency we have to verify
             // that the dependency is not of the type Artifact.OVERRIDE_PATH,
@@ -287,8 +327,6 @@
                 directory.mkdirs();
             }
 
-            LOGGER.info( getMessage( "download.message", artifact ) );
-
             if ( getRemoteArtifact( artifact ) )
             {
                 // The dependency has been successfully downloaded so lets remove
@@ -300,15 +338,13 @@
                 if ( artifact.exists() )
                 {
                     // The snapshot jar locally exists and not in remote repository
-                    String message = getMessage( "not.existing.artifact.in.repo", artifact.getUrlPath()
);
-                    LOGGER.info( message );
+                    //LOGGER.info( getMessage( "not.existing.artifact.in.repo", artifact.getUrlPath()
) );
                     i.remove();
                 }
-                else
-                {
-                    String warning = getMessage( "failed.download.warning", artifact.getName()
);
-                    LOGGER.warn( warning );
-                }
+                //                else
+                //                {
+                //                    LOGGER.error( getMessage( "failed.download.warning",
artifact.getName() ) );
+                //                }
             }
         }
     }
@@ -325,54 +361,25 @@
     {
         boolean artifactFound = false;
 
-        MavenJellyContext context = getProject().getContext();
+        int count = 0;
 
-        ProxyInfo proxyInfo = null;
-        if ( context.getProxyHost() != null )
+        Iterator i = getProject().getContext().getMavenRepoRemote().iterator();
+        while(i.hasNext())
         {
-            proxyInfo = new ProxyInfo();
-            proxyInfo.setHost( context.getProxyHost() );
-            try
+            String remoteRepo = (String) i.next();
+
+            if ( artifact.isSnapshot() && artifact.exists() )
             {
-                proxyInfo.setPort( Integer.valueOf( context.getProxyPort() ).intValue() );
+                LOGGER.info( getMessage( "update.message" ) + " " + artifact.getDescription()
+ " from " + remoteRepo );
             }
-            catch ( NumberFormatException e )
+            else
             {
-                LOGGER.warn( "Ignoring invalid proxy port: '" + context.getProxyPort() +
"'" );
+                LOGGER
+                    .info( getMessage( "download.message" ) + " " + artifact.getDescription()
+ " from " + remoteRepo );
             }
-            proxyInfo.setUserName( context.getProxyUserName() );
-            proxyInfo.setPassword( context.getProxyPassword() );
-            proxyInfo.setNonProxyHosts( (String) context.getVariable( MavenConstants.PROXY_NONPROXYHOSTS
) );
-            proxyInfo.setNtlmHost( (String) context.getVariable( MavenConstants.PROXY_NTLM_HOST
) );
-            proxyInfo.setNtlmDomain( (String) context.getVariable( MavenConstants.PROXY_NTLM_DOMAIN
) );
-        }
-
-        String meterType = (String) context.getVariable( MavenConstants.DOWNLOAD_METER );
-        if ( meterType == null )
-        {
-            meterType = "console";
-        }
+            //LOGGER.info( "Searching in repository : " + remoteRepo );
 
-        TransferListener listener = null;
-
-        if ( "bootstrap".equals( meterType ) )
-        {
-            listener = new BootstrapDownloadMeter();
-        }
-        else if ( "console".equals( meterType ) )
-        {
-            listener = new ConsoleDownloadMeter();
-        }
-
-        int count = 0;
-
-        for ( Iterator i = context.getMavenRepoRemote().iterator(); i.hasNext(); count++
)
-        {
-            String remoteRepo = (String) i.next();
-
-            LOGGER.info( "Searching in repository : " + remoteRepo );
-
-            Repository repository = new Repository( "repo" + count, remoteRepo.trim() );
+            Repository repository = new Repository( "repo" + count++, remoteRepo.trim() );
 
             final Wagon wagon = new DefaultWagonFactory().getWagon( repository.getProtocol()
);
 
@@ -579,7 +586,6 @@
             {
                 break;
             }
-
         }
 
         return artifactFound;

Modified: maven/maven-1/core/trunk/src/messages/messages.properties
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/messages/messages.properties?view=diff&rev=496548&r1=496547&r2=496548
==============================================================================
--- maven/maven-1/core/trunk/src/messages/messages.properties (original)
+++ maven/maven-1/core/trunk/src/messages/messages.properties Mon Jan 15 16:19:56 2007
@@ -27,13 +27,15 @@
 single.unsatisfied.dependency.error=The build cannot continue because of the following unsatisfied
dependency:
 multiple.unsatisfied.dependency.error=The build cannot continue because of the following
unsatisfied dependencies:
 offline.snapshot.warning=You are working offline so the build will continue, but ${1} may
be out of date!
-download.message=Attempting to download ${1}.
+download.message=- Attempting to download
+update.message=- Checking for an update of
 skip.download.message=Skipping download as local copy is up to date!
-satisfy.project.message=Trying to get missing/snapshot dependencies required by ${1}:
+satisfy.project.message=Trying to get missing dependencies and to update snapshots required
by ${1}:
 plugin.loading.error=The plugin ${1} could not be loaded.
 empty.descriptor.error=The ${1} file you specified has zero length.
 checksum.verification.error=The follow artifact is corrupt: ${1}.
 not.existing.artifact.in.repo=Artifact ${1} doesn't exist in remote repository, but it exists
locally.
+line=-------------------------------------------------------------------------------
 
 # For org.apache.maven.cli.App
 build.failed=BUILD FAILED



Mime
View raw message