PR: MNG-795

create an empty fileset if there were no dependencies downloaded


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@267425 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-09-03 06:18:23 +00:00
parent c23770947f
commit 7195dc05d7
3 changed files with 31 additions and 15 deletions

View File

@ -28,6 +28,14 @@
</typedef>
</target>
<target name="test-no-deps" depends="initTaskDefs">
<artifact:dependencies filesetId="runtime.fileset">
</artifact:dependencies>
<copy todir="target/test-no-deps" verbose="true">
<fileset refid="runtime.fileset" />
</copy>
</target>
<target name="test-bad-dep" depends="initTaskDefs">
<artifact:dependencies pathId="dependency.classpath" filesetId="dependency.fileset">
<dependency groupId="foo" artifactId="foo" version="1.0-alpha-2"/>

View File

@ -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 )

View File

@ -192,11 +192,6 @@
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
<field-name>artifactTransformations</field-name>
</requirement>
<requirement>
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
<role-hint>snapshot</role-hint>
<field-name>snapshotTransformation</field-name>
</requirement>
</requirements>
</component>