diff --git a/maven-artifact-ant/sample.build.xml b/maven-artifact-ant/sample.build.xml index 789e6b9fff..d2d37e2d14 100644 --- a/maven-artifact-ant/sample.build.xml +++ b/maven-artifact-ant/sample.build.xml @@ -28,6 +28,14 @@ + + + + + + + + diff --git a/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java index bdf1701fd1..c8ced69dca 100755 --- a/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java +++ b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java @@ -32,6 +32,7 @@ import org.apache.maven.model.Repository; import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.project.artifact.MavenMetadataSource; import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; import org.apache.tools.ant.types.FileList; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; @@ -102,6 +103,11 @@ public class DependenciesTask pom = createDummyPom(); } + if ( dependencies.isEmpty() ) + { + log( "There were no dependencies specified", Project.MSG_WARN ); + } + Set artifacts; try { @@ -165,17 +171,24 @@ public class DependenciesTask FileSet fileSet = new FileSet(); fileSet.setDir( fileList.getDir( getProject() ) ); - for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); ) + if ( result.getArtifacts().isEmpty() ) { - Artifact artifact = (Artifact) i.next(); - String filename = localRepo.pathOf( artifact ); - - FileList.FileName file = new FileList.FileName(); - file.setName( filename ); - - fileList.addConfiguredFile( file ); - - fileSet.createInclude().setName( filename ); + fileSet.createExclude().setName( "**/**" ); + } + else + { + for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); ) + { + Artifact artifact = (Artifact) i.next(); + String filename = localRepo.pathOf( artifact ); + + FileList.FileName file = new FileList.FileName(); + file.setName( filename ); + + fileList.addConfiguredFile( file ); + + fileSet.createInclude().setName( filename ); + } } if ( pathId != null ) diff --git a/maven-artifact-ant/src/main/resources/META-INF/plexus/components.xml b/maven-artifact-ant/src/main/resources/META-INF/plexus/components.xml index 16a693b5c5..bc27eb68e2 100644 --- a/maven-artifact-ant/src/main/resources/META-INF/plexus/components.xml +++ b/maven-artifact-ant/src/main/resources/META-INF/plexus/components.xml @@ -192,11 +192,6 @@ org.apache.maven.artifact.transform.ArtifactTransformation artifactTransformations - - org.apache.maven.artifact.transform.ArtifactTransformation - snapshot - snapshotTransformation -