jvanzyl 2003/11/24 12:16:24 Modified: src/bootstrap/org/apache/maven BootstrapTask.java Log: o more formatting Revision Changes Path 1.19 +33 -59 maven/src/bootstrap/org/apache/maven/BootstrapTask.java Index: BootstrapTask.java =================================================================== RCS file: /home/cvs/maven/src/bootstrap/org/apache/maven/BootstrapTask.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- BootstrapTask.java 24 Nov 2003 20:07:30 -0000 1.18 +++ BootstrapTask.java 24 Nov 2003 20:16:24 -0000 1.19 @@ -56,24 +56,21 @@ * ==================================================================== */ -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ArrayList; - import org.apache.maven.util.HttpUtils; - import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.PatternSet; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + /** * Get a list of resources from a website. * @@ -83,52 +80,27 @@ extends Task { private BootstrapPomParser bootstrapPomParser; + private File projectDescriptor; + private List dependencies; - private File mavenLocalRepo; - // http retrieval - /** - * Whether verbose logging should be performed - */ - private boolean verbose = false; + private File mavenRepoLocal; - /** - * whether the remote timestamp should be placed on the download file - */ private boolean useTimestamp = true; - /** - * whether the task should fail on a HTTP error - */ private boolean ignoreErrors = true; - /** - * A URL that the files are relative to - */ private String baseUrl; - /** whether bootstrap is online */ private String online; - /** - * Proxy host - */ private String proxyHost; - /** - * Proxy port - */ private String proxyPort; - /** - * Proxy userName - */ private String proxyUserName; - /** - * Proxy password - */ private String proxyPassword; /** list of files to process */ @@ -174,17 +146,17 @@ /** * Sets the basedir attribute of the BootstrapTask object */ - public void setMavenLocalRepo( File mavenLocalRepo ) + public void setMavenRepoLocal( File mavenRepoLocal ) { - this.mavenLocalRepo = mavenLocalRepo; + this.mavenRepoLocal = mavenRepoLocal; } /** * Gets the basedir attribute of the BootstrapTask object */ - public File getMavenLocalRepo() + public File getMavenRepoLocal() { - return mavenLocalRepo; + return mavenRepoLocal; } // http @@ -268,16 +240,6 @@ } /** - * Be verbose, if set to "<CODE>true</CODE>". - * - * @param v if "true" then be verbose - */ - public void setVerbose( boolean v ) - { - verbose = v; - } - - /** * Don't stop if get fails if set to "<CODE>true</CODE>". * * @param v if "true" then don't report download errors up to ant @@ -320,25 +282,31 @@ throw new BuildException( "baseUrl attribute is required" ); } - if ( mavenLocalRepo == null ) + if ( mavenRepoLocal == null ) { - throw new BuildException( "mavenLocalRepo attribute is required" ); + throw new BuildException( "mavenRepoLocal attribute is required" ); } - if ( mavenLocalRepo.exists() && !mavenLocalRepo.canWrite() ) + if ( mavenRepoLocal.exists() && !mavenRepoLocal.canWrite() ) { throw new BuildException( "Can't write to " - + mavenLocalRepo.getAbsolutePath() ); + + mavenRepoLocal.getAbsolutePath() ); } + System.out.println( "Using the following for your maven.repo.local: " + mavenRepoLocal ); + bootstrapPomParser = new BootstrapPomParser(); + bootstrapPomParser.parse( getProjectDescriptor() ); + dependencies = bootstrapPomParser.getDependencies(); List list = new ArrayList(); + for ( Iterator i = dependencies.iterator(); i.hasNext(); ) { Dependency d = (Dependency) i.next(); + list.add( getArtifactPath( d, "/" ) ); } @@ -349,8 +317,10 @@ downloadDependencies(); } - createClasspathReference( project, "bootstrap-classpath", list, mavenLocalRepo ); + createClasspathReference( project, "bootstrap-classpath", list, mavenRepoLocal ); + createPatternSetReference( project, "bootstrap-patternset", list ); + try { createDependencyCopyScript(); @@ -448,11 +418,13 @@ try { String file = (String) j.next(); - File destinationFile = new File( mavenLocalRepo, file ); + + File destinationFile = new File( mavenRepoLocal, file ); // The directory structure for this project may // not exists so create it if missing. File directory = destinationFile.getParentFile(); + if ( directory.exists() == false ) { directory.mkdirs(); @@ -461,6 +433,7 @@ log( "Downloading dependency: " + baseUrl + file ); int numRetries = 3; + while ( numRetries >= 0 ) { try @@ -478,6 +451,7 @@ catch ( Exception e ) { numRetries--; + continue; } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]