File m2Dir = new File( System.getProperty( "user.home" ), ".m2" );
File settingsFile = new File( m2Dir, "settings.xml" );
String localRepo = null;
if ( settingsFile.exists() )
{
Settings settings = new SettingsXpp3Reader().read( new FileReader( settingsFile ) );
localRepo = settings.getLocalRepository();
}
if ( localRepo == null )
{
localRepo = System.getProperty( "user.home" ) + "/.m2/repository";