From 269fa793685a77f0f2fb826eb908c1ef2757b624 Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Tue, 27 Jul 2004 16:59:04 +0000 Subject: [PATCH] o added an offline mode to the bootstrap, so on my machine I can bootstrap in 20s when ibiblio isn't consulted. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162898 13f79535-47bb-0310-9956-ffa450edef68 --- maven-mboot2/src/main/java/MBoot.java | 33 +++++++++++++++++++-------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/maven-mboot2/src/main/java/MBoot.java b/maven-mboot2/src/main/java/MBoot.java index 2d5dbe5aa9..5eea882b1f 100644 --- a/maven-mboot2/src/main/java/MBoot.java +++ b/maven-mboot2/src/main/java/MBoot.java @@ -105,6 +105,8 @@ public class MBoot private List coreDeps; + private boolean online = true; + // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- @@ -120,7 +122,7 @@ public static void main( String[] args ) public void run( String[] args ) throws Exception { - File mavenPropertiesFile = new File( System.getProperty( "user.home" ), "maven.properties" ); + File mavenPropertiesFile = new File( System.getProperty( "user.home" ), "maven.properties" ); if ( !mavenPropertiesFile.exists() ) { @@ -143,7 +145,14 @@ public void run( String[] args ) { String key = (String) i.next(); - properties.setProperty( key, StringUtils.interpolate( properties.getProperty(key), System.getProperties() ) ); + properties.setProperty( key, StringUtils.interpolate( properties.getProperty( key ), System.getProperties() ) ); + } + + String onlineProperty = properties.getProperty( "maven.online" ); + + if ( onlineProperty != null && onlineProperty.equals( "false" ) ) + { + online = false; } downloader = new ArtifactDownloader( properties ); @@ -154,13 +163,18 @@ public void run( String[] args ) String basedir = System.getProperty( "user.dir" ); - checkMBootDeps(); + mbootDependencies = Arrays.asList( deps ); + + if ( online ) + { + checkMBootDeps(); + } // Install maven-components POM - installPomFile( repoLocal, new File( basedir, "pom.xml" ) ); + installPomFile( repoLocal, new File( basedir, "pom.xml" ) ); // Install plugin-parent POM - installPomFile( repoLocal, new File( basedir, "maven-plugins/pom.xml" ) ); + installPomFile( repoLocal, new File( basedir, "maven-plugins/pom.xml" ) ); for ( int i = 0; i < builds.length; i++ ) { @@ -356,9 +370,12 @@ public void buildProject( String basedir ) // Download deps // ---------------------------------------------------------------------- - System.out.println( "Downloading dependencies ..." ); + if ( online ) + { + System.out.println( "Downloading dependencies ..." ); - downloadDependencies( reader.getDependencies() ); + downloadDependencies( reader.getDependencies() ); + } // ---------------------------------------------------------------------- // Generating sources @@ -526,8 +543,6 @@ private void checkMBootDeps() { System.out.println( "Checking for MBoot's dependencies ..." ); - mbootDependencies = Arrays.asList( deps ); - downloader.downloadDependencies( mbootDependencies ); }