Index: src/main/java/org/apache/maven/continuum/management/DataManagementCli.java
===================================================================
--- src/main/java/org/apache/maven/continuum/management/DataManagementCli.java	(revision 756960)
+++ src/main/java/org/apache/maven/continuum/management/DataManagementCli.java	(working copy)
@@ -19,8 +19,18 @@
  * under the License.
  */
 
-import com.sampullara.cli.Args;
-import com.sampullara.cli.Argument;
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
 import org.apache.log4j.BasicConfigurator;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
@@ -55,17 +65,8 @@
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
+import com.sampullara.cli.Args;
+import com.sampullara.cli.Argument;
 
 /**
  * An application for performing database upgrades from old Continuum and Redback versions. A suitable tool until it
@@ -351,7 +352,7 @@
         remoteRepositories.add(
             factory.createArtifactRepository( "central", "http://repo1.maven.org/maven2", layout, null, null ) );
         //Load extra repositories from active profile
-        
+
         Settings settings = getSettings( container );
         List<String> profileIds = settings.getActiveProfiles();
         List<Profile> profiles = settings.getProfiles();
@@ -372,7 +373,7 @@
                 }
             }
         }
-        
+
         ArtifactFactory artifactFactory = (ArtifactFactory) container.lookup( ArtifactFactory.ROLE );
         Artifact artifact =
             artifactFactory.createArtifact( groupId, artifactId, version, Artifact.SCOPE_RUNTIME, "jar" );
@@ -408,26 +409,56 @@
     private static String getLocalRepositoryURL( PlexusContainer container )
         throws ComponentLookupException, IOException
     {
-        File settingsFile = new File( System.getProperty( "user.home" ), ".m2/settings.xml" );
-        if ( !settingsFile.exists() )
+        String m2Home = null;
+        try
+        {
+            m2Home = System.getenv( "M2_HOME" );
+        }
+        catch ( SecurityException e )
+        {
+            LOGGER.debug( "You can't access to M2_HOME environment variable" );
+        }
+        File settingsFile;
+        if ( m2Home != null )
         {
-            return new File( System.getProperty( "user.home" ), ".m2/repository" ).toURL().toString();
+            settingsFile = new File( m2Home, "conf/settings.xml" );
         }
         else
         {
-            Settings settings = getSettings( container );
-            return new File( settings.getLocalRepository() ).toURL().toString();
+            settingsFile = new File( System.getProperty( "user.home" ), ".m2/settings.xml" );
+        }
+        if ( settingsFile.exists() )
+        {
+            Settings settings = getSettings( container, settingsFile);
+            return new File( settings.getLocalRepository() ).toURI().toString();
+        }
+        else
+        {
+            return new File( System.getProperty( "user.home" ), ".m2/repository" ).toURI().toString();
         }
     }
 
     private static Settings getSettings( PlexusContainer container )
         throws ComponentLookupException, IOException
     {
+        return getSettings( container, null );
+    }
+
+    private static Settings getSettings( PlexusContainer container, File file )
+        throws ComponentLookupException, IOException
+    {
         MavenSettingsBuilder mavenSettingsBuilder =
             (MavenSettingsBuilder) container.lookup( MavenSettingsBuilder.class.getName() );
         try
         {
-            return mavenSettingsBuilder.buildSettings( false );
+            if ( file != null && file.exists() )
+            {
+                return mavenSettingsBuilder.buildSettings( file, false );
+            }
+            else
+            {
+                return mavenSettingsBuilder.buildSettings( false );
+            }
         }
         catch ( XmlPullParserException e )
         {

