diff --git a/bootstrap/bootstrap-installer/pom.xml b/bootstrap/bootstrap-installer/pom.xml index ae78e0b5af..fa80af00f3 100644 --- a/bootstrap/bootstrap-installer/pom.xml +++ b/bootstrap/bootstrap-installer/pom.xml @@ -12,5 +12,10 @@ bootstrap-mini 2.0.1-SNAPSHOT + + org.codehaus.plexus + plexus-utils + 1.0.4 + diff --git a/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/bootstrap/installer/BootstrapInstaller.java b/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/bootstrap/installer/BootstrapInstaller.java index 8db905ed85..e7f3b5d702 100644 --- a/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/bootstrap/installer/BootstrapInstaller.java +++ b/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/bootstrap/installer/BootstrapInstaller.java @@ -20,6 +20,9 @@ import org.apache.maven.bootstrap.model.Dependency; import org.apache.maven.bootstrap.model.ModelReader; import org.apache.maven.bootstrap.util.FileUtils; import org.apache.maven.bootstrap.Bootstrap; +import org.codehaus.plexus.util.Os; +import org.codehaus.plexus.util.cli.Commandline; +import org.codehaus.plexus.util.cli.CommandLineException; import java.io.File; import java.io.IOException; @@ -71,7 +74,7 @@ public class BootstrapInstaller } private void createInstallation( File dir ) - throws IOException + throws IOException, CommandLineException, InterruptedException { FileUtils.deleteDirectory( dir ); @@ -117,5 +120,18 @@ public class BootstrapInstaller File srcBinDirectory = new File( reader.getProjectFile().getParentFile(), "src/bin" ); FileUtils.copyDirectory( srcBinDirectory, binDirectory, null, "**/.svn/**" ); + + if ( Os.isFamily( "unix" ) ) + { + Commandline cli = new Commandline(); + + cli.setExecutable( "chmod" ); + + cli.createArgument().setValue( "+x" ); + + cli.createArgument().setValue( new File( binDirectory, "mvn" ).getAbsolutePath() ); + + cli.execute().waitFor(); + } } } diff --git a/bootstrap/bootstrap-installer/src/main/resources/META-INF/MANIFEST.MF b/bootstrap/bootstrap-installer/src/main/resources/META-INF/MANIFEST.MF index 29d4216433..76eeaa09bf 100644 --- a/bootstrap/bootstrap-installer/src/main/resources/META-INF/MANIFEST.MF +++ b/bootstrap/bootstrap-installer/src/main/resources/META-INF/MANIFEST.MF @@ -1,2 +1,3 @@ Manifest-Version: 1.0 Main-Class: org.apache.maven.bootstrap.installer.BootstrapInstaller +Class-Path: bootstrap-mini-2.0.1-SNAPSHOT.jar plexus-utils-1.0.4.jar diff --git a/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/Bootstrap.java b/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/Bootstrap.java index e606b77895..19fbb74689 100644 --- a/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/Bootstrap.java +++ b/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/Bootstrap.java @@ -138,16 +138,20 @@ public class Bootstrap String basedir = System.getProperty( "user.dir" ); + File pom = new File( basedir, "pom.xml" ); + ModelReader reader = readModel( resolver, pom, true ); + File jar = buildProject( reader ); + if ( "install".equals( goal ) ) { - File pom = new File( basedir, "pom.xml" ); - ModelReader reader = readModel( resolver, pom, true ); - File jar = buildProject( reader ); install( reader, pom, jar ); } - else + + for ( Iterator i = reader.getDependencies().iterator(); i.hasNext(); ) { - buildProject( new File( basedir ), false ); + Dependency dep = (Dependency) i.next(); + + FileUtils.copyFileToDirectory( resolver.getArtifactFile( dep ), jar.getParentFile() ); } stats( fullStart, new Date() ); diff --git a/bootstrap/bootstrap.sh b/bootstrap/bootstrap.sh index 1d8687d9ed..eff8041ce4 100755 --- a/bootstrap/bootstrap.sh +++ b/bootstrap/bootstrap.sh @@ -17,6 +17,6 @@ BOOTSTRAP_JAR=../bootstrap-mini/target/bootstrap-mini-2.0.1-SNAPSHOT.jar ( cd .. - java -classpath bootstrap/bootstrap-installer/target/bootstrap-installer-2.0.1-SNAPSHOT.jar:bootstrap/bootstrap-mini/target/bootstrap-mini-2.0.1-SNAPSHOT.jar org.apache.maven.bootstrap.installer.BootstrapInstaller + java -jar bootstrap/bootstrap-installer/target/bootstrap-installer-2.0.1-SNAPSHOT.jar )