continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r547512 - /maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java
Date Fri, 15 Jun 2007 03:33:58 GMT
Author: brett
Date: Thu Jun 14 20:33:57 2007
New Revision: 547512

URL: http://svn.apache.org/viewvc?view=rev&rev=547512
Log:
get jars from snapshot repo if they are snapshots

Modified:
    maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java

Modified: maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java?view=diff&rev=547512&r1=547511&r2=547512
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java
(original)
+++ maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java
Thu Jun 14 20:33:57 2007
@@ -52,6 +52,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Properties;
 
 /**
  * An application for performing database upgrades from old Continuum and Redback versions.
A suitable tool until it
@@ -143,6 +144,8 @@
         throws PlexusContainerException, ComponentLookupException, ArtifactNotFoundException,
         ArtifactResolutionException, IOException
     {
+        String applicationVersion = getVersion();
+
         DatabaseParams params = new DatabaseParams( databaseType.defaultParams );
         params.setUrl( jdbcUrl );
 
@@ -151,7 +154,7 @@
         artifacts.addAll(
             downloadArtifact( container, params.getGroupId(), params.getArtifactId(), params.getVersion()
) );
         artifacts.addAll(
-            downloadArtifact( container, "org.apache.maven.continuum", managementArtifactId,
"1.1-SNAPSHOT" ) );
+            downloadArtifact( container, "org.apache.maven.continuum", managementArtifactId,
applicationVersion ) );
         artifacts.addAll( downloadArtifact( container, "jpox", "jpox", databaseFormat.getJpoxVersion()
) );
 
         List<File> jars = new ArrayList<File>();
@@ -241,14 +244,19 @@
         ArtifactRepository localRepository =
             factory.createArtifactRepository( "local", file.toURL().toString(), layout, null,
null );
 
-        List<ArtifactRepository> remoteRepositories = Collections.singletonList(
-            factory.createArtifactRepository( "central", "http://repo1.maven.org/maven2",
layout, null, null ) );
+        List<ArtifactRepository> remoteRepositories = new ArrayList<ArtifactRepository>();
+        remoteRepositories.add( factory.createArtifactRepository( "central", "http://repo1.maven.org/maven2",
layout, null, null ) );
 
         ArtifactFactory artifactFactory = (ArtifactFactory) container.lookup( ArtifactFactory.ROLE
);
         Artifact artifact =
             artifactFactory.createArtifact( groupId, artifactId, version, Artifact.SCOPE_RUNTIME,
"jar" );
         Artifact dummyArtifact = artifactFactory.createProjectArtifact( "dummy", "dummy",
"1.0" );
 
+        if ( artifact.isSnapshot() )
+	{
+	    remoteRepositories.add( factory.createArtifactRepository( "apache.snapshots", "http://people.apache.org/repo/m2-snapshot-repository",
layout, null, null ) );
+        }
+
         ArtifactResolver resolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE
);
 
         List<String> exclusions = new ArrayList<String>();
@@ -267,6 +275,14 @@
                                                                         remoteRepositories,
source, filter );
 
         return result.getArtifacts();
+    }
+
+    private static String getVersion()
+        throws IOException
+    {
+        Properties properties = new Properties();
+        properties.load( DataManagementCli.class.getResourceAsStream( "/META-INF/maven/org.apache.maven.continuum/data-management-api/pom.properties"
) );
+        return properties.getProperty( "version" );
     }
 
     private static class Commands



Mime
View raw message