You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by og...@apache.org on 2009/04/12 08:26:02 UTC

svn commit: r764283 - in /maven/mercury/trunk: ./ mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/ mercury-it/ mercury-it/src/test/java/org/apache/maven/mercury/plexus/ mercury-it/src/test/java/org/apache/maven/mercury/repository/tests...

Author: ogusakov
Date: Sun Apr 12 06:26:01 2009
New Revision: 764283

URL: http://svn.apache.org/viewvc?rev=764283&view=rev
Log:
[MERCURY-115] rearranged dependencies, started working on ncache

Added:
    maven/mercury/trunk/mercury-util/src/test/java/org/apache/maven/mercury/util/TimeUtilTest.java   (with props)
Modified:
    maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/ArtifactMetadata.java
    maven/mercury/trunk/mercury-it/pom.xml
    maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/plexus/DefaultPlexusMercuryTest.java
    maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/repository/tests/ComprehensiveRepositoryTest.java
    maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/repository/tests/ReadWriteTest.java
    maven/mercury/trunk/mercury-md/mercury-md-sat/pom.xml
    maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java
    maven/mercury/trunk/mercury-md/mercury-md-shared/pom.xml
    maven/mercury/trunk/mercury-md/pom.xml
    maven/mercury/trunk/mercury-plexus/pom.xml
    maven/mercury/trunk/mercury-repo/mercury-repo-api/pom.xml
    maven/mercury/trunk/mercury-repo/mercury-repo-api/src/main/java/org/apache/maven/mercury/repository/api/RepositoryGAMetadata.java
    maven/mercury/trunk/mercury-repo/mercury-repo-api/src/main/java/org/apache/maven/mercury/repository/api/RepositoryGAVMetadata.java
    maven/mercury/trunk/mercury-repo/mercury-repo-cache-fs/pom.xml
    maven/mercury/trunk/mercury-repo/mercury-repo-cache-fs/src/main/java/org/apache/maven/mercury/repository/cache/fs/CachedGAMetadata.java
    maven/mercury/trunk/mercury-repo/mercury-repo-local-flat/pom.xml
    maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/pom.xml
    maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/ArtifactLocation.java
    maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryM2.java
    maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java
    maven/mercury/trunk/mercury-repo/mercury-repo-local-map/pom.xml
    maven/mercury/trunk/mercury-repo/mercury-repo-remote-m2/pom.xml
    maven/mercury/trunk/mercury-repo/mercury-repo-remote-m2/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryReaderM2.java
    maven/mercury/trunk/mercury-repo/mercury-repo-virtual/pom.xml
    maven/mercury/trunk/mercury-repo/mercury-repo-virtual/src/main/java/org/apache/maven/mercury/repository/virtual/VirtualRepositoryReader.java
    maven/mercury/trunk/mercury-repo/pom.xml
    maven/mercury/trunk/mercury-transport/mercury-transport-http/pom.xml
    maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/TimeUtil.java
    maven/mercury/trunk/mercury-wagon/pom.xml
    maven/mercury/trunk/pom.xml

Modified: maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/ArtifactMetadata.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/ArtifactMetadata.java?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/ArtifactMetadata.java (original)
+++ maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/ArtifactMetadata.java Sun Apr 12 06:26:01 2009
@@ -82,6 +82,9 @@
     protected Collection<ArtifactMetadata> exclusions;
 
     protected Map<String, String> attributes;
+    
+    /** conveniency for SNAPSHOT file timestamp */
+    private String timeStamp;
 
     /**
      * transient helper objects, used by DependencyBuilder.
@@ -779,6 +782,18 @@
     {
         this.datum = datum;
     }
+
+    public String getTimeStamp()
+    {
+        return timeStamp;
+    }
+
+    public void setTimeStamp( String timeStamp )
+    {
+        this.timeStamp = timeStamp;
+    }
+    
+    
     // ---------------------------------------------------------------------------
     // ---------------------------------------------------------------------------
 }

Modified: maven/mercury/trunk/mercury-it/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-it/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-it/pom.xml (original)
+++ maven/mercury/trunk/mercury-it/pom.xml Sun Apr 12 06:26:01 2009
@@ -128,11 +128,36 @@
       <groupId>org.apache.maven.mercury</groupId>
       <artifactId>mercury-plexus</artifactId>
     </dependency>
+    
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-transport-http</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-crypto-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-artifact</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-transport-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-external</artifactId>
+    </dependency>
 
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-container-default</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+    </dependency>
 
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
@@ -184,6 +209,11 @@
         </exclusion>
       </exclusions>
     </dependency>
+    <dependency>
+    	<groupId>commons-cli</groupId>
+    	<artifactId>commons-cli</artifactId>
+    	<scope>test</scope>
+    </dependency>
 
   </dependencies>
 

Modified: maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/plexus/DefaultPlexusMercuryTest.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/plexus/DefaultPlexusMercuryTest.java?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/plexus/DefaultPlexusMercuryTest.java (original)
+++ maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/plexus/DefaultPlexusMercuryTest.java Sun Apr 12 06:26:01 2009
@@ -377,6 +377,53 @@
         assertTrue( res.getChildren().get( 0 ).getChildren().get( 0 ).getMd().equals( new ArtifactMetadata( "asm:asm-tree:3.0" ) ) );
         assertTrue( res.getChildren().get( 0 ).getChildren().get( 0 ).getChildren().get( 0 ).getMd().equals( new ArtifactMetadata( "asm:asm:3.0" ) ) );
     }
+    // -------------------------------------------------------------------------------------
+    public void testResolveListAsTree()
+        throws Exception
+    {
+        Server central = new Server( "central", new URL( "http://repo1.maven.org/maven2" ) );
+        // Server central = new Server( "central", new URL("http://repository.sonatype.org/content/groups/public") );
+
+        repos.add( new RemoteRepositoryM2( central, pm.findDependencyProcessor() ) );
+
+        String artifactId = "asm:asm-xml:3.0";
+
+        String artifactId2 = "cobertura:cobertura:1.8";
+
+        MetadataTreeNode res =
+            pm.resolveAsTree( repos, ArtifactScopeEnum.test, new ArtifactQueryList( artifactId, artifactId2 ), null, null );
+
+        System.out.println( "Resolved as tree:" );
+        MetadataTreeNode.showNode( res, 0 );
+        
+        assertNotNull( res );
+        
+        assertTrue( res.hasChildren() );
+        
+        int nodes = res.countNodes();
+
+        /* tree structure:
+            0 asm:asm-xml:3.0::jar
+              1 asm:asm-util:3.0::jar
+                2 asm:asm-tree:3.0::jar
+                  3 asm:asm:3.0::jar
+         */
+        
+//        assertEquals( 4, nodes );
+//
+//        assertTrue( res.getMd().equals( new ArtifactMetadata( "asm:asm-xml:3.0" ) ) );
+//        assertTrue( res.getChildren().get( 0 ).getMd().equals( new ArtifactMetadata( "asm:asm-util:3.0" ) ) );
+//        assertTrue( res.getChildren().get( 0 ).getChildren().get( 0 ).getMd().equals( new ArtifactMetadata( "asm:asm-tree:3.0" ) ) );
+//        assertTrue( res.getChildren().get( 0 ).getChildren().get( 0 ).getChildren().get( 0 ).getMd().equals( new ArtifactMetadata( "asm:asm:3.0" ) ) );
+
+        List<ArtifactMetadata> res2 =
+            pm.resolve( repos, ArtifactScopeEnum.test, new ArtifactQueryList( artifactId, artifactId2 ), null, null );
+        
+        System.out.println("\n============== as List =========");
+        if( res2 != null )
+            for( ArtifactMetadata a : res2 )
+                System.out.println( a );
+    }
 
     // -------------------------------------------------------------------------------------
     public void testResolvePomAsTree()

Modified: maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/repository/tests/ComprehensiveRepositoryTest.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/repository/tests/ComprehensiveRepositoryTest.java?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/repository/tests/ComprehensiveRepositoryTest.java (original)
+++ maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/repository/tests/ComprehensiveRepositoryTest.java Sun Apr 12 06:26:01 2009
@@ -218,7 +218,7 @@
                     count--;
             }
         }
-        Thread.sleep( 1000L ); // [MERCURY-112] ?
+        Thread.sleep( 2000L ); // [MERCURY-112] ?
     }
     
     public List<Artifact> readArtifact( String name , List<Repository> repos )

Modified: maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/repository/tests/ReadWriteTest.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/repository/tests/ReadWriteTest.java?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/repository/tests/ReadWriteTest.java (original)
+++ maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/repository/tests/ReadWriteTest.java Sun Apr 12 06:26:01 2009
@@ -176,8 +176,6 @@
     
     File aBin = new File( localRepoBase, "a/a/4/a-4-sources.jar" );
     assertTrue( aBin.exists() );
-
-    log.info( a+" - pom length is "+a.getPomBlob().length );
   }
 
 }

Modified: maven/mercury/trunk/mercury-md/mercury-md-sat/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-md/mercury-md-sat/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-md/mercury-md-sat/pom.xml (original)
+++ maven/mercury/trunk/mercury-md/mercury-md-sat/pom.xml Sun Apr 12 06:26:01 2009
@@ -43,27 +43,39 @@
     </dependency>
 
     <dependency>
-      <groupId>commons-digester</groupId>
-      <artifactId>commons-digester</artifactId>
-      <scope>test</scope>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-repo-virtual</artifactId>
     </dependency>
-
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
-      <artifactId>mercury-md-shared</artifactId>
+      <artifactId>mercury-event</artifactId>
     </dependency>
-
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
-      <artifactId>mercury-repo-virtual</artifactId>
+      <artifactId>mercury-util</artifactId>
     </dependency>
-
-  <!--  test deps -->
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
-      <artifactId>mercury-repo-local-m2</artifactId>
-      <scope>test</scope>
+      <artifactId>mercury-artifact</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-repo-api</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-logging</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-external</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+    </dependency>
+
+  <!--  test deps -->
 
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
@@ -77,6 +89,11 @@
       <artifactId>mercury-repo-remote-m2</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+    	<groupId>commons-digester</groupId>
+    	<artifactId>commons-digester</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>

Modified: maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java (original)
+++ maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java Sun Apr 12 06:26:01 2009
@@ -422,6 +422,7 @@
                         am.setVersion( ver.getVersion() );
                         am.setInclusions( ver.getInclusions() );
                         am.setExclusions( ver.getExclusions() );
+                        am.setOptional( ver.isOptional() );
                     }
                 }
 
@@ -455,7 +456,7 @@
                 List<ArtifactMetadata> versions = expandedDeps.get( md );
                 if ( versions == null || versions.size() < 1 )
                 {
-                    if ( md.isOptional() )
+                    if ( md.isOptional() || checkOptional( node) )
                         continue;
 
                     throw new MetadataTreeException( LANG.getMessage( "not.optional.missing" ) + md + " <== "+ showPath( node ) );
@@ -653,8 +654,22 @@
     }
 
     // -----------------------------------------------------
+    private boolean checkOptional( MetadataTreeNode node )
+    {
+        MetadataTreeNode p = node;
+
+        while ( p != null )
+        {
+            if( p.getMd() != null && p.getMd().isOptional() )
+                return true;
+            
+            p = p.getParent();
+        }
+
+        return false;
+    }
+    // -----------------------------------------------------
     private String showPath( MetadataTreeNode node )
-        throws MetadataTreeCircularDependencyException
     {
         StringBuilder sb = new StringBuilder( 256 );
 

Modified: maven/mercury/trunk/mercury-md/mercury-md-shared/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-md/mercury-md-shared/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-md/mercury-md-shared/pom.xml (original)
+++ maven/mercury/trunk/mercury-md/mercury-md-shared/pom.xml Sun Apr 12 06:26:01 2009
@@ -37,25 +37,34 @@
       <artifactId>mercury-artifact</artifactId>
     </dependency>
 
-    <!--
-     | for some reason transitive does not work - have to copy deps from mercury-util
-     | but it works fine under m2eclipse
-     -->
-
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
       <artifactId>mercury-util</artifactId>
     </dependency>
 
     <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+    </dependency>
+
+    <dependency>
       <groupId>org.apache.maven.mercury</groupId>
-      <artifactId>mercury-crypto-basic</artifactId>
+      <artifactId>mercury-crypto-api</artifactId>
+      <scope>test</scope>
     </dependency>
 
     <dependency>
-      <groupId>commons-cli</groupId>
-      <artifactId>commons-cli</artifactId>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-logging</artifactId>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+    	<groupId>commons-cli</groupId>
+    	<artifactId>commons-cli</artifactId>
+    	<scope>test</scope>
     </dependency>
+
   </dependencies>
 
   <build>

Modified: maven/mercury/trunk/mercury-md/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-md/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-md/pom.xml (original)
+++ maven/mercury/trunk/mercury-md/pom.xml Sun Apr 12 06:26:01 2009
@@ -35,16 +35,4 @@
     <module>mercury-md-sat</module>
     <module>mercury-md-shared</module>
   </modules>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.maven.mercury</groupId>
-      <artifactId>mercury-logging</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.maven.mercury</groupId>
-      <artifactId>mercury-event</artifactId>
-    </dependency>
-  </dependencies>
 </project>
\ No newline at end of file

Modified: maven/mercury/trunk/mercury-plexus/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-plexus/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-plexus/pom.xml (original)
+++ maven/mercury/trunk/mercury-plexus/pom.xml Sun Apr 12 06:26:01 2009
@@ -44,12 +44,6 @@
     </dependency>
 <!-- 
  -->
-  
-    <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-utils</artifactId>
-    </dependency>
-
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
       <artifactId>mercury-repo-remote-m2</artifactId>
@@ -71,18 +65,46 @@
     </dependency>
 
     <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-container-default</artifactId>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-crypto-basic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-util</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-crypto-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-artifact</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-repo-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-transport-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-external</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-repo-local-m2</artifactId>
     </dependency>
 
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-component-annotations</artifactId>
+      <artifactId>plexus-container-default</artifactId>
     </dependency>
 
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-component-metadata</artifactId>
+      <artifactId>plexus-component-annotations</artifactId>
     </dependency>
 
   </dependencies>

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-api/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-api/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-api/pom.xml (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-api/pom.xml Sun Apr 12 06:26:01 2009
@@ -57,5 +57,10 @@
       <groupId>org.apache.maven.mercury</groupId>
       <artifactId>mercury-md-shared</artifactId>
     </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-util</artifactId>
+    </dependency>
   </dependencies>
 </project>
\ No newline at end of file

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-api/src/main/java/org/apache/maven/mercury/repository/api/RepositoryGAMetadata.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-api/src/main/java/org/apache/maven/mercury/repository/api/RepositoryGAMetadata.java?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-api/src/main/java/org/apache/maven/mercury/repository/api/RepositoryGAMetadata.java (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-api/src/main/java/org/apache/maven/mercury/repository/api/RepositoryGAMetadata.java Sun Apr 12 06:26:01 2009
@@ -35,6 +35,9 @@
     /** is set true by cache implementation when determined that it's time to refresh */
     protected transient boolean expired = false;
 
+    /** negative yes */
+    protected transient boolean negativeResult = false;
+
     protected RepositoryGAMetadata()
     {
     }
@@ -134,4 +137,14 @@
         this.expired = expired;
     }
 
+    public boolean isNegativeResult()
+    {
+        return negativeResult;
+    }
+
+    public void setNegativeResult( boolean negativeResult )
+    {
+        this.negativeResult = negativeResult;
+    }
+    
 }

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-api/src/main/java/org/apache/maven/mercury/repository/api/RepositoryGAVMetadata.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-api/src/main/java/org/apache/maven/mercury/repository/api/RepositoryGAVMetadata.java?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-api/src/main/java/org/apache/maven/mercury/repository/api/RepositoryGAVMetadata.java (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-api/src/main/java/org/apache/maven/mercury/repository/api/RepositoryGAVMetadata.java Sun Apr 12 06:26:01 2009
@@ -58,6 +58,9 @@
     /** is set true by cache implementation when determined that it's time to refresh */
     protected transient boolean expired = false;
 
+    /** negative yes */
+    protected transient boolean negativeResult = false;
+
     protected RepositoryGAVMetadata()
     {
     }
@@ -180,4 +183,14 @@
         this.expired = expired;
     }
 
+    public boolean isNegativeResult()
+    {
+        return negativeResult;
+    }
+
+    public void setNegativeResult( boolean negativeResult )
+    {
+        this.negativeResult = negativeResult;
+    }
+
 }

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-cache-fs/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-cache-fs/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-cache-fs/pom.xml (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-cache-fs/pom.xml Sun Apr 12 06:26:01 2009
@@ -66,6 +66,33 @@
       <groupId>org.apache.maven.mercury</groupId>
       <artifactId>mercury-repo-local-m2</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-md-shared</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-artifact</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-util</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-event</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+    </dependency>
+     
+    <dependency>
+      <groupId>commons-cli</groupId>
+      <artifactId>commons-cli</artifactId>
+      <scope>test</scope>
+    </dependency>
+    
   </dependencies>
 
 </project>
\ No newline at end of file

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-cache-fs/src/main/java/org/apache/maven/mercury/repository/cache/fs/CachedGAMetadata.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-cache-fs/src/main/java/org/apache/maven/mercury/repository/cache/fs/CachedGAMetadata.java?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-cache-fs/src/main/java/org/apache/maven/mercury/repository/cache/fs/CachedGAMetadata.java (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-cache-fs/src/main/java/org/apache/maven/mercury/repository/cache/fs/CachedGAMetadata.java Sun Apr 12 06:26:01 2009
@@ -44,6 +44,7 @@
   public static final String ATTR_GROUP_ID = "groupId";
   public static final String ATTR_ARTIFACT_ID = "artifactId";
   public static final String ATTR_VERSION = "version";
+  public static final String ATTR_NEGATIVE = "negative";
 
   public static final String ELEM_VERSIONS = "versions";
 
@@ -86,6 +87,11 @@
       this.versions.addAll( verList );
 
     String lChk = cm.getLastUpdate();
+    
+    String negative = cm.getAttribute( ELEM_COORDINATES, ATTR_NEGATIVE, false );
+    
+    if( !Util.isEmpty( negative ) )
+        setNegativeResult( Boolean.parseBoolean( negative ) );
 
     lastCheck = Long.parseLong( lChk );
   }
@@ -97,6 +103,9 @@
     cm.setAttribute( ELEM_COORDINATES, ATTR_GROUP_ID, ga.getGroupId() );
     cm.setAttribute( ELEM_COORDINATES, ATTR_ARTIFACT_ID, ga.getArtifactId() );
     
+    if( isNegativeResult() )
+        cm.setAttribute( ELEM_COORDINATES, ATTR_NEGATIVE, "true" );
+    
     if( !Util.isEmpty( versions ) )
       cm.setAttribute( ELEM_VERSIONS, ATTR_VERSION, versions );
     

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-local-flat/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-local-flat/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-local-flat/pom.xml (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-local-flat/pom.xml Sun Apr 12 06:26:01 2009
@@ -38,25 +38,31 @@
     </dependency>
 
     <dependency>
-      <groupId>commons-digester</groupId>
-      <artifactId>commons-digester</artifactId>
-      <scope>test</scope>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-util</artifactId>
     </dependency>
 
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
-      <artifactId>mercury-md-shared</artifactId>
+      <artifactId>mercury-artifact</artifactId>
     </dependency>
-
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
-      <artifactId>mercury-util</artifactId>
+      <artifactId>mercury-crypto-api</artifactId>
     </dependency>
-
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
-      <artifactId>mercury-crypto-basic</artifactId>
+      <artifactId>mercury-transport-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-logging</artifactId>
+    </dependency>
+    <dependency>
+    	<groupId>commons-cli</groupId>
+    	<artifactId>commons-cli</artifactId>
       <scope>test</scope>
     </dependency>
+    
   </dependencies>
 </project>
\ No newline at end of file

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/pom.xml (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/pom.xml Sun Apr 12 06:26:01 2009
@@ -48,9 +48,40 @@
 
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-artifact</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-crypto-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-transport-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-logging</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-external</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
       <artifactId>mercury-crypto-basic</artifactId>
       <scope>test</scope>
     </dependency>
+    
+    <dependency>
+      <groupId>commons-cli</groupId>
+      <artifactId>commons-cli</artifactId>
+      <scope>test</scope>
+    </dependency>
 
     <dependency>
       <groupId>commons-digester</groupId>

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/ArtifactLocation.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/ArtifactLocation.java?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/ArtifactLocation.java (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/ArtifactLocation.java Sun Apr 12 06:26:01 2009
@@ -176,6 +176,24 @@
     
     return ver;
   }
+  
+  public static String getFileTS( String name  )
+  {
+      if( name == null )
+          return null;
+      
+      int lastDash = name.lastIndexOf( '-' );
+      if( lastDash < 2 )
+          return null;
+      
+      int firstDash = name.lastIndexOf( '-', lastDash-1 );
+      if( firstDash < 1 )
+          return null;
+      
+      String fTS = name.substring( firstDash+1, lastDash );
+      
+      return fTS;
+  }
   //---------------------------------------------------------------------------------------------------------------
   public static String calculateVersionDir( String ver )
   {

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryM2.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryM2.java?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryM2.java (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryM2.java Sun Apr 12 06:26:01 2009
@@ -41,6 +41,11 @@
     private File directory;
     
     public static final String METADATA_FILE_NAME = "maven-metadata-local.xml";
+    
+    /** indicates that if a-1.0-SNAPSHOT.jar exists, it wins despite any timestamps
+     *  required for Maven comatibility 
+     **/
+    private boolean _snapshotAlwaysWins = false;
 
     //----------------------------------------------------------------------------------
     private void setDirectory( File directory )
@@ -135,6 +140,17 @@
     {
       return true;
     }
+
+    public void setSnapshotAlwaysWins( boolean alwaysWins )
+    {
+        _snapshotAlwaysWins = alwaysWins;
+    }
+
+    public boolean getSnapshotAlwaysWins()
+    {
+        return _snapshotAlwaysWins;
+    }
+    
     //----------------------------------------------------------------------------------
     public String getType()
     {

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java Sun Apr 12 06:26:01 2009
@@ -55,6 +55,7 @@
 import org.apache.maven.mercury.repository.api.RepositoryException;
 import org.apache.maven.mercury.repository.api.RepositoryReader;
 import org.apache.maven.mercury.util.FileUtil;
+import org.apache.maven.mercury.util.TimeUtil;
 import org.apache.maven.mercury.util.Util;
 import org.codehaus.plexus.lang.DefaultLanguage;
 import org.codehaus.plexus.lang.Language;
@@ -66,11 +67,6 @@
     private static final IMercuryLogger LOG = MercuryLoggerManager.getLogger( LocalRepositoryReaderM2.class );
 
     private static final Language LANG = new DefaultLanguage( LocalRepositoryReaderM2.class );
-    
-    /** indicates that if a-1.0-SNAPSHOT.jar exists, it wins despite any timestamps
-     *  required for Maven comatibility 
-     **/
-    private boolean _snapshotAlwaysWins = false;
 
     // ---------------------------------------------------------------------------------------------------------------
     private static final String[] _protocols = new String[] { "file" };
@@ -426,12 +422,13 @@
         final boolean virtualExists = snapshotFile.exists();
         
         final long  virtualLM = virtualExists ? snapshotFile.lastModified() : 0L;
+        final String virtualTS = virtualExists ? TimeUtil.defaultToSnTs( virtualLM ) : "00000000.000000";
 
         // TS exists - return it
         if ( ! virtualRequested )
             return snapshotFile.exists();
 
-        if( virtualExists &&  _snapshotAlwaysWins )
+        if( virtualExists &&  ((LocalRepositoryM2)_repo).getSnapshotAlwaysWins() )
             return true;
         
         // no real SNAPSHOT file, let's try to find one
@@ -461,9 +458,9 @@
                                         }
                                         
                                         // otherwise - only add it if older'n the SNAPSHOT
-                                        long fLM = new File( dir, name ).lastModified();
+                                        String fTS = ArtifactLocation.getFileTS( name );
                                         
-                                        if( fLM >= virtualLM )
+                                        if( fTS.compareTo( virtualTS ) >= 0 )
                                         {
                                             ts.add( ver );
                                             
@@ -484,6 +481,7 @@
         {
             if( virtualExists ) // none were older'n the snapshot
             {
+                md.setTimeStamp( virtualTS );
                 return true;
             }
             
@@ -550,6 +548,7 @@
                 vmd.setClassifier( md.getClassifier() );
                 vmd.setType( md.getType() );
                 vmd.setVersion( loc.getVersion() );
+                vmd.setTimeStamp( md.getTimeStamp() );
 
                 res = MetadataResults.add( res, md, vmd );
 
@@ -684,11 +683,5 @@
     {
     }
     // ---------------------------------------------------------------------------------------------------------------
-
-    public void setSnapshotAlwaysWins( boolean alwaysWins )
-    {
-        _snapshotAlwaysWins = alwaysWins;
-    }
-    
     
 }

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-local-map/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-local-map/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-local-map/pom.xml (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-local-map/pom.xml Sun Apr 12 06:26:01 2009
@@ -38,24 +38,20 @@
 
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
-      <artifactId>mercury-md-shared</artifactId>
+      <artifactId>mercury-util</artifactId>
     </dependency>
 
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
-      <artifactId>mercury-util</artifactId>
+      <artifactId>mercury-artifact</artifactId>
     </dependency>
-
     <dependency>
-      <groupId>commons-digester</groupId>
-      <artifactId>commons-digester</artifactId>
-      <scope>test</scope>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-external</artifactId>
     </dependency>
-
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
-      <artifactId>mercury-repo-remote-m2</artifactId>
-      <scope>test</scope>
+      <artifactId>mercury-logging</artifactId>
     </dependency>
 
     <dependency>
@@ -64,12 +60,16 @@
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
-
     <dependency>
-      <groupId>org.apache.maven.mercury</groupId>
-      <artifactId>mercury-repo-virtual</artifactId>
+      <groupId>commons-cli</groupId>
+      <artifactId>commons-cli</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+    	<groupId>commons-digester</groupId>
+    	<artifactId>commons-digester</artifactId>
+    	<scope>test</scope>
+    </dependency>
 
   </dependencies>
 

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-remote-m2/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-remote-m2/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-remote-m2/pom.xml (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-remote-m2/pom.xml Sun Apr 12 06:26:01 2009
@@ -50,5 +50,42 @@
       <groupId>org.apache.maven.mercury</groupId>
       <artifactId>mercury-repo-local-m2</artifactId>
     </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-artifact</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-util</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-crypto-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-transport-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-logging</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-external</artifactId>
+    </dependency>
+     
+    <dependency>
+      <groupId>commons-cli</groupId>
+      <artifactId>commons-cli</artifactId>
+      <scope>test</scope>
+    </dependency>
+    
   </dependencies>
 </project>
\ No newline at end of file

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-remote-m2/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryReaderM2.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-remote-m2/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryReaderM2.java?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-remote-m2/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryReaderM2.java (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-remote-m2/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryReaderM2.java Sun Apr 12 06:26:01 2009
@@ -436,7 +436,9 @@
                 LOG.info( LANG.getMessage( "read.artifact", loc.getAbsPath(), Util.convertLength( binFile.length() ) ) );
 
             da.setFile( binFile );
+            
             da.setPomBlob( FileUtil.readRawData( isPom ? binFile : pomFile ) );
+            
             res.add( md, da );
         }
     }
@@ -607,7 +609,7 @@
                 coord.setVersion( loc.getVersion() );
 
                 gam = _mdCache.findGA( _repo.getId(), _repo.getUpdatePolicy(), coord );
-
+                
                 if ( gam != null && !gam.isExpired() )
                 {
                     gaVersions = gam.getVersions();
@@ -637,7 +639,6 @@
 
                     if ( pom != null && pom.length > 1 )
                     {
-
                         String oldSnapshot = findDuplicateSnapshot( ver, gaVersions );
 
                         if ( oldSnapshot != null )
@@ -683,6 +684,7 @@
                 String binPath =
                     loc.getGaPath() + FileUtil.SEP + versionDir + FileUtil.SEP + bmd.getArtifactId() + "-"
                         + ver + ".pom";
+
                 byte[] pom = readRawData( binPath, true );
 
                 if ( pom != null ) // version exists
@@ -730,6 +732,14 @@
         {
             LOG.warn( LANG.getMessage( "maven.metadata.no.versions", loc.getGaPath() + FileUtil.SEP
                 + _repo.getMetadataName(), _repo.getId() ) );
+            
+            if( gam != null && _mdCache != null )
+            {
+                gam.setNegativeResult( true );
+                // cache negative result
+                _mdCache.updateGA( _repo.getId(), gam );
+            }
+
             return null;
         }
 

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-virtual/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-virtual/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-virtual/pom.xml (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-virtual/pom.xml Sun Apr 12 06:26:01 2009
@@ -64,15 +64,40 @@
       <groupId>org.apache.maven.mercury</groupId>
       <artifactId>mercury-repo-cache-fs</artifactId>
     </dependency>
-
-    <!-- Test deps -->
-<!--
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-event</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-util</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-artifact</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-repo-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-transport-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-logging</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-external</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
       <artifactId>mercury-repo-local-m2</artifactId>
-      <scope>test</scope>
     </dependency>
- -->
+
+    <!-- Test deps -->
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
       <artifactId>mercury-repo-local-m2</artifactId>
@@ -97,6 +122,12 @@
       <groupId>org.apache.maven.mercury</groupId>
       <artifactId>mercury-repo-remote-m2</artifactId>
     </dependency>
+    
+    <dependency>
+      <groupId>commons-cli</groupId>
+      <artifactId>commons-cli</artifactId>
+      <scope>test</scope>
+    </dependency>
 
   </dependencies>
 </project>
\ No newline at end of file

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-virtual/src/main/java/org/apache/maven/mercury/repository/virtual/VirtualRepositoryReader.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-virtual/src/main/java/org/apache/maven/mercury/repository/virtual/VirtualRepositoryReader.java?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-virtual/src/main/java/org/apache/maven/mercury/repository/virtual/VirtualRepositoryReader.java (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-virtual/src/main/java/org/apache/maven/mercury/repository/virtual/VirtualRepositoryReader.java Sun Apr 12 06:26:01 2009
@@ -317,7 +317,6 @@
 
         try
         {
-
             if ( _eventManager != null )
             {
                 event = new GenericEvent( EventTypeEnum.virtualRepositoryReader, EVENT_READ_VERSIONS );
@@ -474,6 +473,7 @@
         }
     }
 
+    /** order all found versions per query, then leave only the last one hanging */
     private void processSingletons( ArtifactMetadata key, List<ArtifactMetadata> res )
     {
         if ( Util.isEmpty( res ) || !DefaultArtifactVersion.isVirtual( key.getVersion() ) )
@@ -486,17 +486,36 @@
                         {
                             public int compare( ArtifactMetadata o1, ArtifactMetadata o2 )
                             {
-                                  DefaultArtifactVersion av1 = new DefaultArtifactVersion( o1.getVersion() );
-                                  DefaultArtifactVersion av2 = new DefaultArtifactVersion( o2.getVersion() );
+                                String v1 = o1.getVersion();
+                                String v2 = o2.getVersion();
+                                
+                                if( o1.isVirtualSnapshot() && o1.getTimeStamp() != null )
+                                    v1 = v1.replace( Artifact.SNAPSHOT_VERSION, o1.getTimeStamp()+"-00" );
+                                
+                                if( o2.isVirtualSnapshot() && o2.getTimeStamp() != null )
+                                    v2 = v2.replace( Artifact.SNAPSHOT_VERSION, o2.getTimeStamp()+"-00" );
+                                
+                                  DefaultArtifactVersion av1 = new DefaultArtifactVersion( v1 );
+                                  DefaultArtifactVersion av2 = new DefaultArtifactVersion( v2 );
 
                                   return av1.compareTo( av2 );
                             }
 
                         }
-                                                                              );
+                                                                      );
         ts.addAll( res );
 
         ArtifactMetadata single = ts.last();
+        
+        // Oleg: -SNAPSHOT should always win        
+//        if( key.isVirtualSnapshot() )
+//        {
+//            ArtifactMetadata first = ts.first();
+//            
+//            if( first.isVirtualSnapshot() )
+//                single = first;
+//        }
+            
 
         res.clear();
 
@@ -1222,8 +1241,15 @@
                         + ( Util.isEmpty( type ) ? "" : ", type=" + type );
                 event = new GenericEvent( EventTypeEnum.virtualRepositoryReader, EVENT_READ_RAW, eventTag );
             }
+
+            ArtifactMetadata bmdQuery = new ArtifactMetadata(bmd);
             
-            ArtifactMetadata bmdQuery = bmd;
+            if( !Util.isEmpty( type ))
+                bmdQuery.setType( type );
+            
+            // pom cannot have classifiers
+            if( "pom".equals( bmdQuery.getType() ) )
+                bmdQuery.setClassifier( null );
 
             try
             {
@@ -1246,7 +1272,7 @@
             {
                 List<ArtifactMetadata> query = new ArrayList<ArtifactMetadata>( 1 );
                 
-                ArtifactMetadata nBmd = new ArtifactMetadata( bmd.toString() );
+                ArtifactMetadata nBmd = new ArtifactMetadata( bmdQuery );
                 
                 if( !Util.isEmpty( type ))
                     nBmd.setType( type );
@@ -1270,12 +1296,16 @@
                     if ( vRes.hasResults( nBmd ) )
                     {
                         List<ArtifactMetadata> versions = vRes.getResult( nBmd );
+                        
+                        processSingletons( nBmd, versions );
 
-                        TreeSet<ArtifactMetadata> snapshots =
-                            new TreeSet<ArtifactMetadata>( new MetadataVersionComparator() );
-                        snapshots.addAll( versions );
-
-                        bmdQuery = snapshots.last();
+//                        TreeSet<ArtifactMetadata> snapshots =
+//                            new TreeSet<ArtifactMetadata>( new MetadataVersionComparator() );
+//                        snapshots.addAll( versions );
+//
+//                        bmdQuery = snapshots.last();
+                        
+                        bmdQuery = versions.get( 0 );
                     }
                     else
                     {

Modified: maven/mercury/trunk/mercury-repo/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/pom.xml (original)
+++ maven/mercury/trunk/mercury-repo/pom.xml Sun Apr 12 06:26:01 2009
@@ -40,11 +40,4 @@
     <module>mercury-repo-cache-fs</module>
     <module>mercury-repo-virtual</module>
   </modules>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.maven.mercury</groupId>
-      <artifactId>mercury-logging</artifactId>
-    </dependency>
-  </dependencies>
 </project>
\ No newline at end of file

Modified: maven/mercury/trunk/mercury-transport/mercury-transport-http/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-transport/mercury-transport-http/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-transport/mercury-transport-http/pom.xml (original)
+++ maven/mercury/trunk/mercury-transport/mercury-transport-http/pom.xml Sun Apr 12 06:26:01 2009
@@ -58,18 +58,16 @@
       <artifactId>jetty-util5</artifactId>
     </dependency>
 
-
-<!--
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty-client</artifactId>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-crypto-api</artifactId>
     </dependency>
 
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>servlet-api-2.5</artifactId>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
     </dependency>
--->
+
     <!-- Test Dependencies -->
     <dependency>
       <groupId>org.mortbay.jetty</groupId>

Modified: maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/TimeUtil.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/TimeUtil.java?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/TimeUtil.java (original)
+++ maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/TimeUtil.java Sun Apr 12 06:26:01 2009
@@ -18,8 +18,11 @@
  */
 package org.apache.maven.mercury.util;
 
+import java.text.DateFormat;
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.TimeZone;
 
 /**
  * @author Oleg Gusakov
@@ -31,6 +34,8 @@
 
     public static final java.text.DateFormat TS_FORMAT = new java.text.SimpleDateFormat( "yyyyMMddHHmmss" );
 
+    public static final java.text.DateFormat SN_TS_FORMAT = new java.text.SimpleDateFormat( "yyyyMMdd.HHmmss" );
+
     static
     {
         TS_FORMAT.setTimeZone( TS_TZ );
@@ -96,6 +101,44 @@
 
         return dts.getTime();
     }
+    
+    /**
+     * conver SNAPSHOT timestampt into millis
+     * 
+     * @param ts
+     * @return
+     * @throws ParseException
+     */
+    public static long snTstoMillis( String ts )
+    throws ParseException
+    {
+        if( ts == null )
+            return 0;
+        
+        int dot = ts.indexOf( '.' );
+        
+        int dash = ts.indexOf( '-' );
+        
+        int lastInd = dash == -1 ? ts.length() : dash;
+        
+        if( dot == -1 )
+            return toMillis( ts );
+        
+        return toMillis( ts.substring( 0, dot )+ts.substring( dot+1, lastInd ) );
+    }
+    
+    /**
+     * convert current millis to UTC timestamp
+     * @param local
+     * @return
+     */
+    public static String defaultToSnTs( long local )
+    {
+      Date lDate = new Date(local);
+
+      SN_TS_FORMAT.setTimeZone( TS_TZ );
+      return SN_TS_FORMAT.format(lDate);
+    }
 
     public static void main( String[] args ) throws Exception
     {

Added: maven/mercury/trunk/mercury-util/src/test/java/org/apache/maven/mercury/util/TimeUtilTest.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-util/src/test/java/org/apache/maven/mercury/util/TimeUtilTest.java?rev=764283&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-util/src/test/java/org/apache/maven/mercury/util/TimeUtilTest.java (added)
+++ maven/mercury/trunk/mercury-util/src/test/java/org/apache/maven/mercury/util/TimeUtilTest.java Sun Apr 12 06:26:01 2009
@@ -0,0 +1,74 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+package org.apache.maven.mercury.util;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ *
+ * @author Oleg Gusakov
+ * @version $Id$
+ *
+ */
+public class TimeUtilTest
+    extends TestCase
+{
+    long expected = 1234550304000L;
+
+    public void testSnTsWithDash()
+    throws Exception
+    {
+        long ts = TimeUtil.snTstoMillis( "20090213.183824-29" );
+        
+        assertEquals( expected, ts );
+    }
+
+    public void testSnTsWithoutDash()
+    throws Exception
+    {
+        long ts = TimeUtil.snTstoMillis( "20090213.183824" );
+        
+        assertEquals( expected, ts );
+    }
+    
+    public void testNow()
+    throws Exception
+    {
+        long now = System.currentTimeMillis();
+        
+        System.out.println( new Date(now) );
+        System.out.println( TimeUtil.defaultToSnTs( now ) );
+        
+        String name = "a-1.0-20090213.183824-90.jar";
+        
+        int lastDash = name.lastIndexOf( '-' );
+        int firstDash = name.lastIndexOf( '-', lastDash-1 );
+        String fTS = name.substring( firstDash+1, lastDash );
+        
+        System.out.println(fTS);
+
+    }
+}

Propchange: maven/mercury/trunk/mercury-util/src/test/java/org/apache/maven/mercury/util/TimeUtilTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/mercury/trunk/mercury-util/src/test/java/org/apache/maven/mercury/util/TimeUtilTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/mercury/trunk/mercury-wagon/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-wagon/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-wagon/pom.xml (original)
+++ maven/mercury/trunk/mercury-wagon/pom.xml Sun Apr 12 06:26:01 2009
@@ -49,18 +49,31 @@
 
     <dependency>
       <groupId>org.apache.maven.mercury</groupId>
-      <artifactId>mercury-util</artifactId>
+      <artifactId>mercury-crypto-basic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-crypto-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-transport-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-logging</artifactId>
     </dependency>
 
     <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-container-default</artifactId>
+      <groupId>org.apache.maven.mercury</groupId>
+      <artifactId>mercury-util</artifactId>
     </dependency>
 
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-utils</artifactId>
+      <artifactId>plexus-container-default</artifactId>
     </dependency>
+
     <dependency>
       <groupId>bouncycastle</groupId>
       <artifactId>bcprov-jdk15</artifactId>

Modified: maven/mercury/trunk/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/pom.xml?rev=764283&r1=764282&r2=764283&view=diff
==============================================================================
--- maven/mercury/trunk/pom.xml (original)
+++ maven/mercury/trunk/pom.xml Sun Apr 12 06:26:01 2009
@@ -65,8 +65,8 @@
     <module>mercury-logging</module>
     <module>mercury-plexus</module>
     <module>mercury-wagon</module>
-<!-- 
     <module>mercury-it</module>
+<!-- 
 -->
 
   </modules>