You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by pg...@apache.org on 2009/11/25 18:07:08 UTC
svn commit: r884196 - in /maven/ant-tasks/trunk/src:
main/java/org/apache/maven/artifact/ant/ site/apt/
Author: pgier
Date: Wed Nov 25 17:07:06 2009
New Revision: 884196
URL: http://svn.apache.org/viewvc?rev=884196&view=rev
Log:
[MANTTASKS-169] Deprecate the verbose option in the dependencies task in favor of using standard Ant verbose output.
Modified:
maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java
maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/AntResolutionListener.java
maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java
maven/ant-tasks/trunk/src/site/apt/reference.apt
Modified: maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java
URL: http://svn.apache.org/viewvc/maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java?rev=884196&r1=884195&r2=884196&view=diff
==============================================================================
--- maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java (original)
+++ maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java Wed Nov 25 17:07:06 2009
@@ -21,6 +21,7 @@
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
@@ -30,6 +31,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
@@ -851,4 +853,34 @@
}
}
+ protected void showVersion()
+ {
+ InputStream resourceAsStream;
+ try
+ {
+ Properties properties = new Properties();
+ resourceAsStream = AbstractArtifactTask.class.getClassLoader().getResourceAsStream(
+ "META-INF/maven/org.apache.maven/maven-ant-tasks/pom.properties" );
+ if ( resourceAsStream != null )
+ {
+ properties.load( resourceAsStream );
+ }
+
+ String version = properties.getProperty( "version", "unknown" );
+ String builtOn = properties.getProperty( "builtOn" );
+ if ( builtOn != null )
+ {
+ log( "Maven Ant Tasks version: " + version + " built on " + builtOn, Project.MSG_VERBOSE );
+ }
+ else
+ {
+ log( "Maven Ant Tasks version: " + version, Project.MSG_VERBOSE );
+ }
+ }
+ catch ( IOException e )
+ {
+ log( "Unable to determine version from Maven Ant Tasks JAR file: " + e.getMessage(), Project.MSG_WARN );
+ }
+ }
+
}
Modified: maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/AntResolutionListener.java
URL: http://svn.apache.org/viewvc/maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/AntResolutionListener.java?rev=884196&r1=884195&r2=884196&view=diff
==============================================================================
--- maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/AntResolutionListener.java (original)
+++ maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/AntResolutionListener.java Wed Nov 25 17:07:06 2009
@@ -33,16 +33,13 @@
public class AntResolutionListener
implements ResolutionListener
{
- private String indent = "";
+ private String indent = " ";
private final Project project;
- private int logLevel;
-
- public AntResolutionListener( Project project, boolean verbose )
+ public AntResolutionListener( Project project )
{
this.project = project;
- logLevel = verbose ? Project.MSG_INFO : Project.MSG_VERBOSE;
}
public void testArtifact( Artifact node )
@@ -61,40 +58,40 @@
public void includeArtifact( Artifact artifact )
{
- project.log( indent + artifact + " (selected)", logLevel );
+ project.log( indent + artifact + " (selected)", Project.MSG_VERBOSE );
}
public void omitForNearer( Artifact omitted, Artifact kept )
{
- project.log( indent + omitted + " (removed - nearer found: " + kept.getVersion() + ")", logLevel );
+ project.log( indent + omitted + " (removed - nearer found: " + kept.getVersion() + ")", Project.MSG_VERBOSE );
}
public void omitForCycle( Artifact omitted )
{
- project.log( indent + omitted + " (removed - causes a cycle in the graph)", logLevel );
+ project.log( indent + omitted + " (removed - causes a cycle in the graph)", Project.MSG_VERBOSE );
}
public void updateScope( Artifact artifact, String scope )
{
- project.log( indent + artifact + " (setting scope to: " + scope + ")", logLevel );
+ project.log( indent + artifact + " (setting scope to: " + scope + ")", Project.MSG_VERBOSE );
}
public void updateScopeCurrentPom( Artifact artifact, String scope )
{
project.log( indent + artifact + " (not setting scope to: " + scope + "; local scope " + artifact.getScope()
- + " wins)", logLevel );
+ + " wins)", Project.MSG_VERBOSE );
}
public void selectVersionFromRange( Artifact artifact )
{
project.log( indent + artifact + " (setting version to: " + artifact.getVersion() + " from range: "
- + artifact.getVersionRange() + ")", logLevel );
+ + artifact.getVersionRange() + ")", Project.MSG_VERBOSE );
}
public void restrictRange( Artifact artifact, Artifact replacement, VersionRange newRange )
{
project.log( indent + artifact + " (range restricted from: " + artifact.getVersionRange() + " and: "
- + replacement.getVersionRange() + " to: " + newRange + " )", logLevel );
+ + replacement.getVersionRange() + " to: " + newRange + " )", Project.MSG_VERBOSE );
}
public void manageArtifact( Artifact artifact, Artifact replacement )
@@ -110,6 +107,6 @@
msg += "applying scope: " + replacement.getScope();
}
msg += ")";
- project.log( msg, logLevel );
+ project.log( msg, Project.MSG_VERBOSE );
}
}
Modified: maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java
URL: http://svn.apache.org/viewvc/maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java?rev=884196&r1=884195&r2=884196&view=diff
==============================================================================
--- maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java (original)
+++ maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java Wed Nov 25 17:07:06 2009
@@ -45,7 +45,6 @@
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -70,24 +69,52 @@
private List dependencies = new ArrayList();
+ /**
+ * The id of the path object containing a list of all dependencies.
+ */
private String pathId;
+ /**
+ * The id of the fileset object containing a list of all dependencies.
+ */
private String filesetId;
+ /**
+ * The id of the fileset object containing all resolved source jars for the list of dependencies.
+ */
private String sourcesFilesetId;
+ /**
+ * The id of the fileset object containing all resolved javadoc jars for the list of dependencies.
+ */
private String javadocFilesetId;
+ /**
+ * The id of the object containing a list of all artifact versions.
+ * This is used for things like removing the version from the dependency filenames.
+ */
private String versionsId;
+ /**
+ * A specific maven scope used to determine which dependencies are resolved.
+ * This takes only a single scope and uses the standard maven ScopeArtifactFilter.
+ */
private String useScope;
+ /**
+ * A comma separated list of dependency scopes to include, in the resulting path and fileset.
+ */
private String scopes;
+ /**
+ * A comma separated list of dependency types to include in the resulting set of artifacts.
+ */
private String type;
- private boolean verbose;
-
+ /**
+ * Add a fileset reference for each resolved dependency. The id of each fileset will follow
+ * the pattern groupId:artifactId:classifier:type.
+ */
private boolean addArtifactFileSetRefs;
/**
@@ -100,6 +127,9 @@
*/
private boolean cacheDependencyRefs;
+ /**
+ * Main task execution. Called by parent execute().
+ */
protected void doExecute()
{
showVersion();
@@ -168,7 +198,7 @@
Artifact pomArtifact = artifactFactory.createBuildArtifact( pom.getGroupId(), pom.getArtifactId(), pom
.getVersion(), pom.getPackaging() );
- List listeners = Collections.singletonList( new AntResolutionListener( getProject(), verbose ) );
+ List listeners = Collections.singletonList( new AntResolutionListener( getProject() ) );
Map managedDependencies = pom.getMavenProject().getManagedVersionMap();
@@ -518,11 +548,13 @@
public void setVerbose( boolean verbose )
{
- this.verbose = verbose;
+ getProject().log( "Option \"verbose\" is deprecated. Please use the standard Ant -v option.",
+ getProject().MSG_WARN );
}
/**
- * Use the maven artifact filtering for a particular scope.
+ * Use the maven artifact filtering for a particular scope. This
+ * uses the standard maven ScopeArtifactFilter.
*
* @param useScope
*/
@@ -551,36 +583,6 @@
this.scopes = scopes;
}
- private void showVersion()
- {
- InputStream resourceAsStream;
- try
- {
- Properties properties = new Properties();
- resourceAsStream = DependenciesTask.class.getClassLoader().getResourceAsStream(
- "META-INF/maven/org.apache.maven/maven-ant-tasks/pom.properties" );
- if ( resourceAsStream != null )
- {
- properties.load( resourceAsStream );
- }
-
- String version = properties.getProperty( "version", "unknown" );
- String builtOn = properties.getProperty( "builtOn" );
- if ( builtOn != null )
- {
- log( "Maven Ant Tasks version: " + version + " built on " + builtOn, Project.MSG_VERBOSE );
- }
- else
- {
- log( "Maven Ant Tasks version: " + version, Project.MSG_VERBOSE );
- }
- }
- catch ( IOException e )
- {
- log( "Unable to determine version from Maven Ant Tasks JAR file: " + e.getMessage(), Project.MSG_WARN );
- }
- }
-
public boolean isAddArtifactFileSetRefs()
{
return addArtifactFileSetRefs;
Modified: maven/ant-tasks/trunk/src/site/apt/reference.apt
URL: http://svn.apache.org/viewvc/maven/ant-tasks/trunk/src/site/apt/reference.apt?rev=884196&r1=884195&r2=884196&view=diff
==============================================================================
--- maven/ant-tasks/trunk/src/site/apt/reference.apt (original)
+++ maven/ant-tasks/trunk/src/site/apt/reference.apt Wed Nov 25 17:07:06 2009
@@ -60,8 +60,6 @@
*-------------------------+---------------------------------------------------------------------------+--------------+-------------+
| <<<scopes>>> | A comma separated list of specific scopes to be retrieved. If no value is provided, all scopes will be included. | No | 2.0.10 |
*-------------------------+---------------------------------------------------------------------------+--------------+-------------+
-| <<<verbose>>> | If <<<true>>> this displays the results of each dependency resolution and their relationships. Default is <false>. | No | |
-*-------------------------+---------------------------------------------------------------------------+--------------+-------------+
| <<<versionsId>>> | The property ID to store the versions of the resolved dependencies, for use by a {{{reference.html#VersionMapper} <<<VersionMapper>>>}}. | No | 2.0.7 |
*-------------------------+---------------------------------------------------------------------------+--------------+-------------+
| <<<addArtifactFileSetRefs>>> | If set to true, will add a fileset for each resolved dependency. The fileset has an id of <<<groupId:artifactId:type[:classifier]>>>. Default is <false>. | No | 2.0.10 |
@@ -70,6 +68,8 @@
*-------------------------+---------------------------------------------------------------------------+--------------+-------------+
| <<<addArtifactFileSetRefs>>> | Defines the name of the file in which to store properties and references to the paths of dependency artifacts. Default is <false>. | No | 2.1.0 |
*-------------------------+---------------------------------------------------------------------------+--------------+-------------+
+| <<<verbose>>> | Deprecated in version 2.1.0. Use the Ant command line -v option for verbose output. | No | |
+*-------------------------+---------------------------------------------------------------------------+--------------+-------------+
The task can include the <<<dependency>>> nested type, in addition to the other shared types
{{{reference.html#localRepository} <<<localRepository>>>}}, {{{reference.html#pom} <<<pom>>>}} and