mirror of https://github.com/apache/maven.git
o some changes to make things work on windows, shouldn't have bothered
with files at all. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162871 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
65a5fee935
commit
058a53422a
|
@ -8,6 +8,4 @@ mkdir ${buildDir}
|
||||||
|
|
||||||
javac -d ${buildDir} @sources.txt
|
javac -d ${buildDir} @sources.txt
|
||||||
|
|
||||||
cp src/main/resources/mboot.deps ${buildDir}/mboot.deps
|
|
||||||
|
|
||||||
( cd ${buildDir} ; jar -cf ../mboot.jar -m ../manifest.txt * )
|
( cd ${buildDir} ; jar -cf ../mboot.jar -m ../manifest.txt * )
|
||||||
|
|
Binary file not shown.
|
@ -12,7 +12,6 @@
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -38,6 +37,37 @@ public class MBoot
|
||||||
// maven-plugin
|
// maven-plugin
|
||||||
// maven-plugins
|
// maven-plugins
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
String[] deps = new String[]
|
||||||
|
{
|
||||||
|
"junit/jars/junit-3.8.1.jar",
|
||||||
|
"surefire/jars/surefire-booter-1.1.jar",
|
||||||
|
"surefire/jars/surefire-1.1.jar",
|
||||||
|
"modello/jars/modello-1.0-SNAPSHOT.jar",
|
||||||
|
"xpp3/jars/xpp3-1.1.3.3.jar",
|
||||||
|
"xstream/jars/xstream-1.0-SNAPSHOT.jar",
|
||||||
|
"qdox/jars/qdox-1.2.jar",
|
||||||
|
"maven/jars/maven-plugin-2.0-SNAPSHOT.jar"
|
||||||
|
};
|
||||||
|
|
||||||
|
String[] builds = new String[]
|
||||||
|
{
|
||||||
|
"maven-model",
|
||||||
|
"maven-plugin",
|
||||||
|
"maven-core",
|
||||||
|
"maven-plugins/maven-clean-plugin",
|
||||||
|
"maven-plugins/maven-compiler-plugin",
|
||||||
|
"maven-plugins/maven-install-plugin",
|
||||||
|
"maven-plugins/maven-jar-plugin",
|
||||||
|
"maven-plugins/maven-plugin-plugin",
|
||||||
|
"maven-plugins/maven-pom-plugin",
|
||||||
|
"maven-plugins/maven-resources-plugin",
|
||||||
|
"maven-plugins/maven-surefire-plugin"
|
||||||
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Standard locations for resources in Maven projects.
|
// Standard locations for resources in Maven projects.
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
@ -101,154 +131,137 @@ public void run( String[] args )
|
||||||
|
|
||||||
checkMBootDeps();
|
checkMBootDeps();
|
||||||
|
|
||||||
File instructions = new File( basedir, "mboot.txt" );
|
for ( int i = 0; i < builds.length; i++ )
|
||||||
|
|
||||||
if ( instructions.exists() )
|
|
||||||
{
|
{
|
||||||
FileInputStream is = new FileInputStream( instructions );
|
String directory = new File( basedir, builds[i] ).getAbsolutePath();
|
||||||
|
|
||||||
StringWriter w = new StringWriter();
|
System.out.println( "Building project in " + directory + " ..." );
|
||||||
|
|
||||||
IOUtil.copy( is, w );
|
System.out.println( "--------------------------------------------------------------------" );
|
||||||
|
|
||||||
String[] deps = StringUtils.split( w.toString(), "\n" );
|
System.setProperty( "basedir", directory );
|
||||||
|
|
||||||
for ( int i = 0; i < deps.length; i++ )
|
buildProject( directory );
|
||||||
|
|
||||||
|
if ( reader.artifactId.equals( "maven-core" ) )
|
||||||
{
|
{
|
||||||
String directory = new File( basedir, deps[i] ).getAbsolutePath();
|
coreDeps = reader.getDependencies();
|
||||||
|
|
||||||
System.out.println( "Building project in " + directory + " ..." );
|
|
||||||
|
|
||||||
System.out.println( "--------------------------------------------------------------------" );
|
|
||||||
|
|
||||||
System.setProperty( "basedir", directory );
|
|
||||||
|
|
||||||
buildProject( directory );
|
|
||||||
|
|
||||||
if ( reader.artifactId.equals( "maven-core" ) )
|
|
||||||
{
|
|
||||||
coreDeps = reader.getDependencies();
|
|
||||||
}
|
|
||||||
|
|
||||||
reader.reset();
|
|
||||||
|
|
||||||
System.out.println( "--------------------------------------------------------------------" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// build the installation
|
reader.reset();
|
||||||
|
|
||||||
String mavenHome;
|
System.out.println( "--------------------------------------------------------------------" );
|
||||||
|
}
|
||||||
|
|
||||||
if ( args.length == 1 )
|
// build the installation
|
||||||
{
|
|
||||||
mavenHome = args[0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mavenHome = System.getProperty( "M2_HOME" );
|
|
||||||
|
|
||||||
System.out.println( "mavenHome = " + mavenHome );
|
String mavenHome;
|
||||||
|
|
||||||
if ( mavenHome == null )
|
if ( args.length == 1 )
|
||||||
{
|
{
|
||||||
mavenHome = new File( System.getProperty( "user.home" ), "m2" ).getAbsolutePath();
|
mavenHome = args[0];
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File dist = new File( mavenHome );
|
|
||||||
|
|
||||||
FileUtils.deleteDirectory( dist );
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// bin
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
String bin = new File( dist, "bin" ).getAbsolutePath();
|
|
||||||
|
|
||||||
FileUtils.mkdir( new File( bin ).getPath() );
|
|
||||||
|
|
||||||
FileUtils.copyFileToDirectory( new File( basedir, "maven-core/src/bin/m2" ).getAbsolutePath(), bin );
|
|
||||||
|
|
||||||
FileUtils.copyFileToDirectory( new File( basedir, "maven-core/src/bin/m2.bat" ).getAbsolutePath(), bin );
|
|
||||||
|
|
||||||
FileUtils.copyFileToDirectory( new File( basedir, "maven-core/src/bin/classworlds.conf" ).getAbsolutePath(), bin );
|
|
||||||
|
|
||||||
if ( Os.isFamily( "unix" ) )
|
|
||||||
{
|
|
||||||
Commandline cli = new Commandline();
|
|
||||||
|
|
||||||
cli.setExecutable( "chmod" );
|
|
||||||
|
|
||||||
cli.createArgument().setValue( "+x" );
|
|
||||||
|
|
||||||
cli.createArgument().setValue( new File( dist, "bin/m2" ).getAbsolutePath() );
|
|
||||||
|
|
||||||
cli.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// core
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
String core = new File( dist, "core" ).getAbsolutePath();
|
|
||||||
|
|
||||||
FileUtils.mkdir( new File( core ).getPath() );
|
|
||||||
|
|
||||||
FileUtils.copyFileToDirectory( repoLocal + "/classworlds/jars/classworlds-1.1-SNAPSHOT.jar", core );
|
|
||||||
|
|
||||||
FileUtils.copyFileToDirectory( repoLocal + "/plexus/jars/plexus-0.14-SNAPSHOT.jar", core );
|
|
||||||
|
|
||||||
FileUtils.copyFileToDirectory( repoLocal + "/xpp3/jars/xpp3-1.1.3.3.jar", core );
|
|
||||||
|
|
||||||
FileUtils.copyFileToDirectory( repoLocal + "/xstream/jars/xstream-1.0-SNAPSHOT.jar", core );
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// lib
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
String lib = new File( dist, "lib" ).getAbsolutePath();
|
|
||||||
|
|
||||||
FileUtils.mkdir( new File( lib ).getPath() );
|
|
||||||
|
|
||||||
for ( Iterator i = coreDeps.iterator(); i.hasNext(); )
|
|
||||||
{
|
|
||||||
Dependency d = (Dependency) i.next();
|
|
||||||
|
|
||||||
if ( d.getArtifactId().equals( "classworlds" ) ||
|
|
||||||
d.artifactId.equals( "plexus" ) ||
|
|
||||||
d.artifactId.equals( "xstream" ) ||
|
|
||||||
d.artifactId.equals( "xpp3" ) )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
FileUtils.copyFileToDirectory( repoLocal + "/" + getArtifactPath( d, "/" ), lib );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy maven itself
|
|
||||||
|
|
||||||
FileUtils.copyFileToDirectory( repoLocal + "/maven/jars/maven-core-2.0-SNAPSHOT.jar", lib );
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// plugins
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
String plugins = new File( dist, "plugins" ).getAbsolutePath();
|
|
||||||
|
|
||||||
FileUtils.mkdir( new File( plugins ).getPath() );
|
|
||||||
|
|
||||||
List libs = FileUtils.getFiles( new File( basedir, "maven-plugins" ), "**/target/*.jar", null );
|
|
||||||
|
|
||||||
for ( Iterator i = libs.iterator(); i.hasNext(); )
|
|
||||||
{
|
|
||||||
File f = (File) i.next();
|
|
||||||
|
|
||||||
FileUtils.copyFileToDirectory( f.getAbsolutePath(), plugins );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buildProject( basedir );
|
mavenHome = System.getProperty( "M2_HOME" );
|
||||||
|
|
||||||
|
System.out.println( "mavenHome = " + mavenHome );
|
||||||
|
|
||||||
|
if ( mavenHome == null )
|
||||||
|
{
|
||||||
|
mavenHome = new File( System.getProperty( "user.home" ), "m2" ).getAbsolutePath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
File dist = new File( mavenHome );
|
||||||
|
|
||||||
|
FileUtils.deleteDirectory( dist );
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// bin
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
String bin = new File( dist, "bin" ).getAbsolutePath();
|
||||||
|
|
||||||
|
FileUtils.mkdir( new File( bin ).getPath() );
|
||||||
|
|
||||||
|
FileUtils.copyFileToDirectory( new File( basedir, "maven-core/src/bin/m2" ).getAbsolutePath(), bin );
|
||||||
|
|
||||||
|
FileUtils.copyFileToDirectory( new File( basedir, "maven-core/src/bin/m2.bat" ).getAbsolutePath(), bin );
|
||||||
|
|
||||||
|
FileUtils.copyFileToDirectory( new File( basedir, "maven-core/src/bin/classworlds.conf" ).getAbsolutePath(), bin );
|
||||||
|
|
||||||
|
if ( Os.isFamily( "unix" ) )
|
||||||
|
{
|
||||||
|
Commandline cli = new Commandline();
|
||||||
|
|
||||||
|
cli.setExecutable( "chmod" );
|
||||||
|
|
||||||
|
cli.createArgument().setValue( "+x" );
|
||||||
|
|
||||||
|
cli.createArgument().setValue( new File( dist, "bin/m2" ).getAbsolutePath() );
|
||||||
|
|
||||||
|
cli.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// core
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
String core = new File( dist, "core" ).getAbsolutePath();
|
||||||
|
|
||||||
|
FileUtils.mkdir( new File( core ).getPath() );
|
||||||
|
|
||||||
|
FileUtils.copyFileToDirectory( repoLocal + "/classworlds/jars/classworlds-1.1-SNAPSHOT.jar", core );
|
||||||
|
|
||||||
|
FileUtils.copyFileToDirectory( repoLocal + "/plexus/jars/plexus-0.14-SNAPSHOT.jar", core );
|
||||||
|
|
||||||
|
FileUtils.copyFileToDirectory( repoLocal + "/xpp3/jars/xpp3-1.1.3.3.jar", core );
|
||||||
|
|
||||||
|
FileUtils.copyFileToDirectory( repoLocal + "/xstream/jars/xstream-1.0-SNAPSHOT.jar", core );
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// lib
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
String lib = new File( dist, "lib" ).getAbsolutePath();
|
||||||
|
|
||||||
|
FileUtils.mkdir( new File( lib ).getPath() );
|
||||||
|
|
||||||
|
for ( Iterator i = coreDeps.iterator(); i.hasNext(); )
|
||||||
|
{
|
||||||
|
Dependency d = (Dependency) i.next();
|
||||||
|
|
||||||
|
if ( d.getArtifactId().equals( "classworlds" ) ||
|
||||||
|
d.artifactId.equals( "plexus" ) ||
|
||||||
|
d.artifactId.equals( "xstream" ) ||
|
||||||
|
d.artifactId.equals( "xpp3" ) )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileUtils.copyFileToDirectory( repoLocal + "/" + getArtifactPath( d, "/" ), lib );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy maven itself
|
||||||
|
|
||||||
|
FileUtils.copyFileToDirectory( repoLocal + "/maven/jars/maven-core-2.0-SNAPSHOT.jar", lib );
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// plugins
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
String plugins = new File( dist, "plugins" ).getAbsolutePath();
|
||||||
|
|
||||||
|
FileUtils.mkdir( new File( plugins ).getPath() );
|
||||||
|
|
||||||
|
List libs = FileUtils.getFiles( new File( basedir, "maven-plugins" ), "**/target/*.jar", null );
|
||||||
|
|
||||||
|
for ( Iterator i = libs.iterator(); i.hasNext(); )
|
||||||
|
{
|
||||||
|
File f = (File) i.next();
|
||||||
|
|
||||||
|
FileUtils.copyFileToDirectory( f.getAbsolutePath(), plugins );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,14 +455,6 @@ private void checkMBootDeps()
|
||||||
{
|
{
|
||||||
System.out.println( "Checking for MBoot's dependencies ..." );
|
System.out.println( "Checking for MBoot's dependencies ..." );
|
||||||
|
|
||||||
InputStream is = MBoot.class.getClassLoader().getResourceAsStream( "mboot.deps" );
|
|
||||||
|
|
||||||
StringWriter w = new StringWriter();
|
|
||||||
|
|
||||||
IOUtil.copy( is, w );
|
|
||||||
|
|
||||||
String[] deps = StringUtils.split( w.toString(), "\n" );
|
|
||||||
|
|
||||||
mbootDependencies = Arrays.asList( deps );
|
mbootDependencies = Arrays.asList( deps );
|
||||||
|
|
||||||
downloader.downloadDependencies( mbootDependencies );
|
downloader.downloadDependencies( mbootDependencies );
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
junit/jars/junit-3.8.1.jar
|
|
||||||
surefire/jars/surefire-booter-1.1.jar
|
|
||||||
surefire/jars/surefire-1.1.jar
|
|
||||||
modello/jars/modello-1.0-SNAPSHOT.jar
|
|
||||||
xpp3/jars/xpp3-1.1.3.3.jar
|
|
||||||
xstream/jars/xstream-1.0-SNAPSHOT.jar
|
|
||||||
qdox/jars/qdox-1.2.jar
|
|
||||||
maven/jars/maven-plugin-2.0-SNAPSHOT.jar
|
|
Loading…
Reference in New Issue