brett 2005/03/31 02:54:32
Modified: maven-mboot2/src/main/java MBoot.java Log: attempt to fix CI by forcing the use of mboot built snapshots Revision Changes Path 1.76 +17 -31 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.75 retrieving revision 1.76 diff -u -r1.75 -r1.76 --- MBoot.java 23 Mar 2005 06:52:53 -0000 1.75 +++ MBoot.java 31 Mar 2005 10:54:32 -0000 1.76 @@ -11,6 +11,7 @@ import test.SurefirePlugin; import util.Commandline; import util.FileUtils; +import util.IOUtil; import util.IsolatedClassLoader; import util.Os; @@ -19,7 +20,9 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.io.FileWriter; import java.io.Serializable; +import java.io.StringReader; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; @@ -81,10 +84,10 @@ String[] pluginBuilds = new String[]{"maven-plugins/maven-assemble-plugin", "maven-plugins/maven-clean-plugin", "maven-plugins/maven-compiler-plugin", "maven-plugins/maven-deploy-plugin", - "maven-plugins/maven-ejb-plugin", "maven-plugins/maven-install-plugin", - "maven-plugins/maven-jar-plugin", "maven-plugins/maven-plugin-plugin", - "maven-plugins/maven-resources-plugin", "maven-plugins/maven-surefire-plugin", - "maven-plugins/maven-war-plugin"}; + "maven-plugins/maven-ejb-plugin", /*"maven-plugins/maven-idea-plugin",*/ + "maven-plugins/maven-install-plugin", "maven-plugins/maven-jar-plugin", + "maven-plugins/maven-plugin-plugin", "maven-plugins/maven-resources-plugin", + "maven-plugins/maven-surefire-plugin", "maven-plugins/maven-war-plugin"}; private static final Map MODELLO_TARGET_VERSIONS; @@ -659,11 +662,11 @@ if ( !reader.artifactId.equals( "maven-plugin" ) && reader.artifactId.endsWith( "plugin" ) ) { - installPlugin( basedir, repoLocal, reader ); + install( basedir, repoLocal, reader, "maven-plugin" ); } else { - installJar( basedir, repoLocal, reader ); + install( basedir, repoLocal, reader, "jar" ); } return reader; @@ -850,7 +853,7 @@ FileUtils.copyFile( new File( basedir, "pom.xml" ), pom ); } - private void installJar( String basedir, String repoLocal, ModelReader reader ) + private void install( String basedir, String repoLocal, ModelReader reader, String type ) throws Exception { String artifactId = reader.artifactId; @@ -869,37 +872,20 @@ version = reader.parentVersion; } - File jar = new File( repoLocal, "/" + groupId + "/jars/" + artifactId + "-" + version + ".jar" ); + String finalName = artifactId + "-" + version; - System.out.println( "Installing JAR: " + jar ); + File file = new File( repoLocal, "/" + groupId + "/" + type + "s/" + finalName + ".jar" ); - FileUtils.copyFile( new File( basedir, BUILD_DIR + "/" + artifactId + "-" + version + ".jar" ), jar ); - } + System.out.println( "Installing: " + file ); - private void installPlugin( String basedir, String repoLocal, ModelReader reader ) - throws Exception - { - String artifactId = reader.artifactId; + FileUtils.copyFile( new File( basedir, BUILD_DIR + "/" + finalName + ".jar" ), file ); - String version = reader.version; - - String groupId = reader.groupId; - - if ( groupId == null ) + if ( version.indexOf( "SNAPSHOT" ) >= 0 ) { - groupId = reader.parentGroupId; - } + File metadata = new File( repoLocal, "/" + groupId + "/poms/" + finalName + ".version.txt" ); - if ( version == null ) - { - version = reader.parentVersion; + IOUtil.copy( new StringReader( version ), new FileWriter( metadata ) ); } - - File jar = new File( repoLocal, "/" + groupId + "/maven-plugins/" + artifactId + "-" + version + ".jar" ); - - System.out.println( "Installing Plugin: " + jar ); - - FileUtils.copyFile( new File( basedir, BUILD_DIR + "/" + artifactId + "-" + version + ".jar" ), jar ); } private void runTests( String basedir, String classes, String testClasses, ModelReader reader )