Author: brianf Date: Fri May 28 01:30:14 2010 New Revision: 949061 URL: http://svn.apache.org/viewvc?rev=949061&view=rev Log: (empty)
Modified: maven/plugins/trunk/maven-dependency-plugin/pom.xml maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/resolvers/ListRepositoriesMojo.java maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java maven/plugins/trunk/maven-dependency-plugin/src/site/apt/usage.apt.vm maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyUtil.java Modified: maven/plugins/trunk/maven-dependency-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/pom.xml?rev=949061&r1=949060&r2=949061&view=diff ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/pom.xml (original) +++ maven/plugins/trunk/maven-dependency-plugin/pom.xml Fri May 28 01:30:14 2010 @@ -228,6 +228,12 @@ under the License. <scope>test</scope> <version>1.1</version> </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.1</version> + <scope>compile</scope> + </dependency> </dependencies> <build> Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/resolvers/ListRepositoriesMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/resolvers/ListRepositoriesMojo.java?rev=949061&r1=949060&r2=949061&view=diff ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/resolvers/ListRepositoriesMojo.java (original) +++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/resolvers/ListRepositoriesMojo.java Fri May 28 01:30:14 2010 @@ -28,13 +28,12 @@ import org.apache.maven.artifact.resolve import org.apache.maven.artifact.resolver.ArtifactResolutionResult; import org.apache.maven.artifact.resolver.ResolutionNode; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.dependency.AbstractResolveMojo; +import org.apache.maven.plugin.dependency.AbstractDependencyMojo; import org.apache.maven.shared.artifact.filter.ScopeArtifactFilter; -import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter; /** - * Goal that resolves all project dependencies, including plugins and reports - * and their dependencies. + * Goal that resolves all project dependencies and then lists the repositories + * used by the build and by the transitive dependencies * * @goal list-repositories * @requiresDependencyResolution test @@ -42,7 +41,7 @@ import org.apache.maven.shared.artifact. * @version $Id: GoOfflineMojo.java 728546 2008-12-21 22:56:51Z bentmann $ * @since 2.2 */ -public class ListRepositoriesMojo extends AbstractResolveMojo +public class ListRepositoriesMojo extends AbstractDependencyMojo { /** * Displays a list of the repositories used by this build. @@ -77,10 +76,4 @@ public class ListRepositoriesMojo extend throw new MojoExecutionException("Unable to resolve artifacts",e); } } - - protected ArtifactsFilter getMarkedArtifactFilter() - { - // TODO Auto-generated method stub - return null; - } } Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java?rev=949061&r1=949060&r2=949061&view=diff ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java (original) +++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java Fri May 28 01:30:14 2010 @@ -31,7 +31,7 @@ import org.codehaus.plexus.util.StringUt /** * Utility class with static helper methods - * + * * @author <a href="mailto:bri...@apache.org">Brian Fox</a> * @version $Id$ */ @@ -39,75 +39,56 @@ public final class DependencyUtil { /** - * Builds the file name. If removeVersion is set, then the file name must be - * reconstructed from the artifactId, Classifier (if used) and Type. - * Otherwise, this method returns the artifact file name. - * - * @param artifact - * File to be formatted. - * @param removeVersion - * Specifies if the version should be removed from the file name. - * @return Formatted file name in the format - * artifactId-[version]-[classifier].[type] + * Builds the file name. If removeVersion is set, then the file name must be reconstructed from the artifactId, + * Classifier (if used) and Type. Otherwise, this method returns the artifact file name. + * + * @param artifact File to be formatted. + * @param removeVersion Specifies if the version should be removed from the file name. + * @return Formatted file name in the format artifactId-[version]-[classifier].[type] */ public static String getFormattedFileName( Artifact artifact, boolean removeVersion ) { String destFileName = null; - // if there is a file and we aren't stripping the version, just get the - // name directly - if ( artifact.getFile() != null && !removeVersion ) + String versionString = null; + if ( !removeVersion ) { - destFileName = artifact.getFile().getName(); + versionString = "-" + artifact.getVersion(); } else - // if offline { - String versionString = null; - if ( !removeVersion ) - { - versionString = "-" + artifact.getVersion(); - } - else - { - versionString = ""; - } + versionString = ""; + } - String classifierString = ""; + String classifierString = ""; - if ( StringUtils.isNotEmpty( artifact.getClassifier() ) ) - { - classifierString = "-" + artifact.getClassifier(); - } + if ( StringUtils.isNotEmpty( artifact.getClassifier() ) ) + { + classifierString = "-" + artifact.getClassifier(); + } - destFileName = artifact.getArtifactId() + versionString + classifierString + "." + destFileName = + artifact.getArtifactId() + versionString + classifierString + "." + artifact.getArtifactHandler().getExtension(); - } + return destFileName; } /** * Formats the outputDirectory based on type. - * - * @param useSubdirsPerType - * if a new sub directory should be used for each type. - * @param useSubdirPerArtifact - * if a new sub directory should be used for each artifact. - * @param useRepositoryLayout - * if dependendies must be moved into a Maven repository layout, if - * set, other settings will be ignored. - * @param removeVersion - * if the version must not be mentioned in the filename - * @param outputDirectory - * base outputDirectory. - * @param artifact - * information about the artifact. - * + * + * @param useSubdirsPerType if a new sub directory should be used for each type. + * @param useSubdirPerArtifact if a new sub directory should be used for each artifact. + * @param useRepositoryLayout if dependendies must be moved into a Maven repository layout, if set, other settings + * will be ignored. + * @param removeVersion if the version must not be mentioned in the filename + * @param outputDirectory base outputDirectory. + * @param artifact information about the artifact. * @return a formatted File object to use for output. */ public static File getFormattedOutputDirectory( boolean useSubdirsPerType, boolean useSubdirPerArtifact, - boolean useRepositoryLayout, boolean removeVersion, - File outputDirectory, Artifact artifact ) + boolean useRepositoryLayout, boolean removeVersion, + File outputDirectory, Artifact artifact ) { StringBuffer sb = new StringBuffer( 128 ); if ( useRepositoryLayout ) @@ -169,15 +150,13 @@ public final class DependencyUtil /** * Writes the specified string to the specified file. - * - * @param string - * the string to write - * @param file - * the file to write to - * @throws IOException - * if an I/O error occurs + * + * @param string the string to write + * @param file the file to write to + * @throws IOException if an I/O error occurs */ - public static synchronized void write( String string, File file, Log log ) throws IOException + public static synchronized void write( String string, File file, Log log ) + throws IOException { file.getParentFile().mkdirs(); @@ -207,13 +186,12 @@ public final class DependencyUtil /** * Writes the specified string to the log at info level. - * - * @param string - * the string to write - * @throws IOException - * if an I/O error occurs + * + * @param string the string to write + * @throws IOException if an I/O error occurs */ - public static synchronized void log( String string, Log log ) throws IOException + public static synchronized void log( String string, Log log ) + throws IOException { BufferedReader reader = new BufferedReader( new StringReader( string ) ); @@ -230,7 +208,7 @@ public final class DependencyUtil // // mainly used to parse excludes,includes configuration // - public static String [] tokenizer( String str ) + public static String[] tokenizer( String str ) { return StringUtils.split( cleanToBeTokenizedString( str ), "," ); } @@ -241,7 +219,7 @@ public final class DependencyUtil public static String cleanToBeTokenizedString( String str ) { String ret = ""; - if ( ! StringUtils.isEmpty( str ) ) + if ( !StringUtils.isEmpty( str ) ) { ret = StringUtils.join( StringUtils.split( str ), "," ); } Modified: maven/plugins/trunk/maven-dependency-plugin/src/site/apt/usage.apt.vm URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/site/apt/usage.apt.vm?rev=949061&r1=949060&r2=949061&view=diff ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/site/apt/usage.apt.vm (original) +++ maven/plugins/trunk/maven-dependency-plugin/src/site/apt/usage.apt.vm Fri May 28 01:30:14 2010 @@ -21,7 +21,7 @@ Allan Ramirez Brian Fox ------ - Jan 2008 + May 2010 ------ Usage @@ -643,3 +643,8 @@ mvn dependency:tree +-----+ mvn dependency:tree -Doutput=/path/to/file +-----+ + +* The <<<dependency:list-repositories>>> Mojo + + This mojo is used to list all the repositories that this build depends upon. It will show repositories defined in your settings, + poms and declared in transitive dependency poms. Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyUtil.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyUtil.java?rev=949061&r1=949060&r2=949061&view=diff ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyUtil.java (original) +++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyUtil.java Fri May 28 01:30:14 2010 @@ -239,7 +239,7 @@ public class TestDependencyUtil artifact.setFile( file ); String name = DependencyUtil.getFormattedFileName( artifact, false ); - String expectedResult = "test-file-name.jar"; + String expectedResult = "two-1.1-SNAPSHOT-sources.war"; assertEquals( expectedResult, name ); name = DependencyUtil.getFormattedFileName( artifact, true );