From b63d6e9d32eeece5e00ba181a7fef8d86158d186 Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Thu, 23 Jun 2005 18:33:19 +0000 Subject: [PATCH] merge changes for rev 193190 from the alpha-3 tag git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@193195 13f79535-47bb-0310-9956-ffa450edef68 --- maven-artifact-ant/sample.build.xml | 10 ++-- maven-core/pom.xml | 2 +- maven-core/src/assemble/bin.xml | 5 +- .../java/org/apache/maven/cli/MavenCli.java | 53 +++++++------------ .../maven/plugin/DefaultPluginManager.java | 13 +---- 5 files changed, 31 insertions(+), 52 deletions(-) diff --git a/maven-artifact-ant/sample.build.xml b/maven-artifact-ant/sample.build.xml index c7dcc10bf7..92ce4ec76b 100644 --- a/maven-artifact-ant/sample.build.xml +++ b/maven-artifact-ant/sample.build.xml @@ -20,7 +20,7 @@ - + @@ -63,16 +63,16 @@ - + - + - + @@ -128,7 +128,7 @@ - + diff --git a/maven-core/pom.xml b/maven-core/pom.xml index e620e15fec..80fe330e78 100644 --- a/maven-core/pom.xml +++ b/maven-core/pom.xml @@ -133,7 +133,7 @@ website - scp://www.apache.org//www/maven.apache.org/m2 + scp://minotaur.apache.org//www/maven.apache.org/m2 diff --git a/maven-core/src/assemble/bin.xml b/maven-core/src/assemble/bin.xml index 528015d548..1c777dd676 100644 --- a/maven-core/src/assemble/bin.xml +++ b/maven-core/src/assemble/bin.xml @@ -28,6 +28,9 @@ maven-core-*.jar + + maven-core-*-sources.jar + @@ -35,6 +38,7 @@ core plexus:plexus-container-default + plexus:plexus-utils @@ -48,7 +52,6 @@ plexus:plexus-container-default classworlds:classworlds - plexus:plexus-utils junit:junit diff --git a/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java index ac63e7b0ca..740ceea588 100644 --- a/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java @@ -55,10 +55,12 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; +import java.io.InputStream; import java.net.URL; import java.util.Collections; import java.util.Enumeration; import java.util.List; +import java.util.Properties; /** * @author Jason van Zyl @@ -117,7 +119,7 @@ public class MavenCli // ---------------------------------------------------------------------- initializeSystemProperties( commandLine ); - + if( commandLine.hasOption( CLIManager.ACTIVATE_PROFILES ) ) { System.setProperty(ProfileActivationUtils.ACTIVE_PROFILE_IDS, commandLine.getOptionValue( CLIManager.ACTIVATE_PROFILES ) ); @@ -189,12 +191,12 @@ public class MavenCli showFatalError( "Unable to read settings.xml", e, showErrors ); return 1; } - + if ( commandLine.hasOption( CLIManager.BATCH_MODE ) ) { settings.setInteractiveMode( false ); } - + if ( commandLine.hasOption( CLIManager.FORCE_PLUGIN_UPDATES ) ) { settings.getRuntimeInfo().setPluginUpdateOverride( Boolean.TRUE ); @@ -397,54 +399,39 @@ public class MavenCli { artifactRepositoryFactory.setGlobalSnapshotPolicy( ArtifactRepository.SNAPSHOT_POLICY_ALWAYS ); } - + if ( commandLine.hasOption( CLIManager.CHECKSUM_FAILURE_POLICY ) ) { System.out.println( "+ Enabling strict checksum verification on all artifact downloads."); - + artifactRepositoryFactory.setGlobalChecksumPolicy( ArtifactRepository.CHECKSUM_POLICY_FAIL ); } else if ( commandLine.hasOption( CLIManager.CHECKSUM_WARNING_POLICY ) ) { System.out.println( "+ Disabling strict checksum verification on all artifact downloads."); - + artifactRepositoryFactory.setGlobalChecksumPolicy( ArtifactRepository.CHECKSUM_POLICY_WARN ); } - + return localRepository; } private static void showVersion() { - // TODO: is there a beter way? Maybe read the manifest? - - String version = "unknown"; - + InputStream resourceAsStream; try { - for ( Enumeration e = MavenCli.class.getClassLoader().getResources( "/META-INF/maven/pom.xml" ); - e.hasMoreElements(); ) - { - URL resource = (URL) e.nextElement(); - if ( resource.getPath().indexOf( "maven-core" ) >= 0 ) - { - MavenXpp3Reader reader = new MavenXpp3Reader(); - Model model = reader.read( new InputStreamReader( resource.openStream() ) ); - version = model.getVersion(); - break; - } - } + Properties properties = new Properties(); + resourceAsStream = MavenCli.class.getClassLoader().getResourceAsStream( + "META-INF/maven/org.apache.maven/maven-core/pom.properties" ); + properties.load( resourceAsStream ); - System.out.println( "Maven version: " + version ); + System.out.println( "Maven version: " + properties.getProperty( "version", "unknown" ) ); } catch ( IOException e ) { System.err.println( "Unable determine version from JAR file: " + e.getMessage() ); } - catch ( XmlPullParserException e ) - { - System.err.println( "Unable to parse POM in JAR file: " + e.getMessage() ); - } } // ---------------------------------------------------------------------- @@ -523,15 +510,15 @@ public class MavenCli public static final char NON_RECURSIVE = 'N'; public static final char UPDATE_SNAPSHOTS = 'U'; - + public static final char ACTIVATE_PROFILES = 'P'; - + public static final String FORCE_PLUGIN_UPDATES = "update-plugins"; - + public static final String SUPPRESS_PLUGIN_UPDATES = "no-plugin-updates"; - + public static final char CHECKSUM_FAILURE_POLICY = 'C'; - + public static final char CHECKSUM_WARNING_POLICY = 'c'; public CLIManager() diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java index eb28773877..8ee8c77ed3 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java @@ -562,7 +562,7 @@ public class DefaultPluginManager ArtifactRepository localRepository = session.getLocalRepository(); Set dependencies = metadataSource.retrieve( pluginArtifact, localRepository, - remoteRepositories ); + project.getPluginArtifactRepositories() ); ArtifactResolutionResult result = artifactResolver.resolveTransitively( dependencies, pluginArtifact, localRepository, @@ -1057,17 +1057,6 @@ public class DefaultPluginManager artifactResolver.resolve( artifact, remoteArtifactRepositories, localRepository ); } - - // TODO: is this really necessary? - for ( Iterator it = project.getPluginArtifacts().iterator(); it.hasNext(); ) - { - Artifact artifact = (Artifact) it.next(); - - artifactResolver.resolve( artifact, remoteArtifactRepositories, localRepository ); - } - - // TODO: is this really necessary? - artifactResolver.resolve( project.getParentArtifact(), remoteArtifactRepositories, localRepository ); } }