You are viewing a plain text version of this content. The canonical link for it is here.
Posted to m2-dev@maven.apache.org by jv...@apache.org on 2004/07/27 03:19:41 UTC
cvs commit: maven-components/maven-mboot2/src/main/java ArtifactDownloader.java JavacCompiler.java MBoot.java
jvanzyl 2004/07/26 18:19:41
Modified: maven-mboot2 mboot.jar
maven-mboot2/src/main/java ArtifactDownloader.java
JavacCompiler.java MBoot.java
Log:
Revision Changes Path
1.4 +145 -131 maven-components/maven-mboot2/mboot.jar
<<Binary file>>
1.3 +2 -18 maven-components/maven-mboot2/src/main/java/ArtifactDownloader.java
Index: ArtifactDownloader.java
===================================================================
RCS file: /home/cvs/maven-components/maven-mboot2/src/main/java/ArtifactDownloader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ArtifactDownloader.java 26 Jul 2004 22:45:09 -0000 1.2
+++ ArtifactDownloader.java 27 Jul 2004 01:19:41 -0000 1.3
@@ -31,17 +31,13 @@
private String proxyPassword;
- public ArtifactDownloader( Properties properties ) throws Exception
+ public ArtifactDownloader( Properties properties )
+ throws Exception
{
setRemoteRepo( properties.getProperty( "maven.repo.remote" ) );
String mavenRepoLocalProperty = properties.getProperty( "maven.repo.local" );
- if ( mavenRepoLocalProperty == null )
- {
- mavenRepoLocalProperty = System.getProperty( "user.home" ) + "/.maven/repository";
- }
-
mavenRepoLocal = new File( mavenRepoLocalProperty );
if ( !mavenRepoLocal.exists() )
@@ -61,19 +57,7 @@
System.exit( 1 );
}
- writeFile( "bootstrap.repo", mavenRepoLocal.getPath() );
-
System.out.println( "Using the following for your maven.repo.local: " + mavenRepoLocal );
- }
-
- private void writeFile( String name, String contents )
- throws Exception
- {
- Writer writer = new FileWriter( name );
-
- writer.write( contents );
-
- writer.close();
}
public File getMavenRepoLocal()
1.2 +7 -0 maven-components/maven-mboot2/src/main/java/JavacCompiler.java
Index: JavacCompiler.java
===================================================================
RCS file: /home/cvs/maven-components/maven-mboot2/src/main/java/JavacCompiler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JavacCompiler.java 26 Jul 2004 03:53:17 -0000 1.1
+++ JavacCompiler.java 27 Jul 2004 01:19:41 -0000 1.2
@@ -25,6 +25,13 @@
public List compile( String[] classpathElements, String[] sourceDirectories, String destinationDirectory )
throws Exception
{
+ /*
+ for ( int i = 0; i < classpathElements.length; i++ )
+ {
+ System.out.println( "classpathElement = " + classpathElements[i] );
+ }
+ */
+
File destinationDir = new File( destinationDirectory );
if ( !destinationDir.exists() )
1.4 +56 -15 maven-components/maven-mboot2/src/main/java/MBoot.java
Index: MBoot.java
===================================================================
RCS file: /home/cvs/maven-components/maven-mboot2/src/main/java/MBoot.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MBoot.java 26 Jul 2004 22:45:09 -0000 1.3
+++ MBoot.java 27 Jul 2004 01:19:41 -0000 1.4
@@ -120,11 +120,31 @@
public void run( String[] args )
throws Exception
{
+ File mavenPropertiesFile = new File( System.getProperty( "user.home" ), "maven.properties" );
+
+ if ( !mavenPropertiesFile.exists() )
+ {
+ System.out.println( "You must have a ~/maven.properties file and must contain the following entries:" );
+
+ System.out.println( "maven.home = /path/to/m2/installtion" );
+
+ System.out.println( "maven.repo.local = /path/to/m2/repository" );
+
+ System.exit( 1 );
+ }
+
Date fullStop;
Date fullStart = new Date();
- properties = loadProperties( new File( System.getProperty( "user.home" ), "build.properties" ) );
+ properties = loadProperties( mavenPropertiesFile );
+
+ for ( Iterator i = properties.keySet().iterator(); i.hasNext(); )
+ {
+ String key = (String) i.next();
+
+ properties.setProperty( key, StringUtils.interpolate( properties.getProperty(key), System.getProperties() ) );
+ }
downloader = new ArtifactDownloader( properties );
@@ -136,16 +156,11 @@
checkMBootDeps();
- if ( !reader.parse( new File( basedir, "pom.xml" ) ) )
- {
- System.err.println( "Could not parse pom.xml" );
+ // Install maven-components POM
+ installPomFile( repoLocal, new File( basedir, "pom.xml" ) );
- System.exit( 1 );
- }
-
- installPom( basedir, repoLocal );
-
- reader.reset();
+ // Install plugin-parent POM
+ installPomFile( repoLocal, new File( basedir, "maven-plugins/pom.xml" ) );
for ( int i = 0; i < builds.length; i++ )
{
@@ -179,9 +194,7 @@
}
else
{
- mavenHome = System.getProperty( "M2_HOME" );
-
- System.out.println( "mavenHome = " + mavenHome );
+ mavenHome = properties.getProperty( "maven.home" );
if ( mavenHome == null )
{
@@ -518,6 +531,31 @@
jarMojo.execute( new File( classes ), buildDir, artifactId + "-" + version );
}
+ private void installPomFile( String repoLocal, File pomIn )
+ throws Exception
+ {
+ if ( !reader.parse( pomIn ) )
+ {
+ System.err.println( "Could not parse pom.xml" );
+
+ System.exit( 1 );
+ }
+
+ String artifactId = reader.artifactId;
+
+ String version = reader.version;
+
+ String groupId = reader.groupId;
+
+ File pom = new File( repoLocal, "/" + groupId + "/poms/" + artifactId + "-" + version + ".pom" );
+
+ System.out.println( "Installing POM: " + pom );
+
+ FileUtils.copyFile( pomIn, pom );
+
+ reader.reset();
+ }
+
private void installPom( String basedir, String repoLocal )
throws Exception
{
@@ -543,8 +581,11 @@
String groupId = reader.groupId;
- FileUtils.copyFile( new File( basedir, BUILD_DIR + "/" + artifactId + "-" + version + ".jar" ),
- new File( repoLocal, "/" + groupId + "/jars/" + artifactId + "-" + version + ".jar" ) );
+ File jar = new File( repoLocal, "/" + groupId + "/jars/" + artifactId + "-" + version + ".jar" );
+
+ System.out.println( "Installing JAR: " + jar );
+
+ FileUtils.copyFile( new File( basedir, BUILD_DIR + "/" + artifactId + "-" + version + ".jar" ), jar );
}
private void runTests( String basedir, String classes, String testClasses )