mirror of https://github.com/apache/maven.git
PR: MNG-408
Add filesetId attribute to dependencies task git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@170498 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
92780b9511
commit
6eb9705933
|
@ -12,12 +12,16 @@
|
||||||
|
|
||||||
<artifact:pom file="pom.xml" id="maven.project"/>
|
<artifact:pom file="pom.xml" id="maven.project"/>
|
||||||
|
|
||||||
<artifact:dependencies pathId="dependency.classpath">
|
<artifact:dependencies pathId="dependency.classpath" filesetId="dependency.fileset">
|
||||||
<dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-2"/>
|
<dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-2"/>
|
||||||
<dependency groupId="org.codehaus.modello" artifactId="modello-core" version="1.0-alpha-2-SNAPSHOT"/>
|
<dependency groupId="org.codehaus.modello" artifactId="modello-core" version="1.0-alpha-2-SNAPSHOT"/>
|
||||||
<localRepository refid="local.repository"/>
|
<localRepository refid="local.repository"/>
|
||||||
</artifact:dependencies>
|
</artifact:dependencies>
|
||||||
|
|
||||||
|
<copy todir="target/files">
|
||||||
|
<fileset refid="dependency.fileset" />
|
||||||
|
</copy>
|
||||||
|
|
||||||
<artifact:install file="target/maven-artifact-ant-2.0-SNAPSHOT.jar">
|
<artifact:install file="target/maven-artifact-ant-2.0-SNAPSHOT.jar">
|
||||||
<localRepository refid="local.repository"/>
|
<localRepository refid="local.repository"/>
|
||||||
<pom refid="maven.project"/>
|
<pom refid="maven.project"/>
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.maven.project.artifact.MavenMetadataSource;
|
||||||
import org.apache.tools.ant.BuildException;
|
import org.apache.tools.ant.BuildException;
|
||||||
import org.apache.tools.ant.types.FileList;
|
import org.apache.tools.ant.types.FileList;
|
||||||
import org.apache.tools.ant.types.Path;
|
import org.apache.tools.ant.types.Path;
|
||||||
|
import org.apache.tools.ant.types.FileSet;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -53,6 +54,8 @@ public class DependenciesTask
|
||||||
|
|
||||||
private String pathId;
|
private String pathId;
|
||||||
|
|
||||||
|
private String filesetId;
|
||||||
|
|
||||||
public void execute()
|
public void execute()
|
||||||
{
|
{
|
||||||
if ( localRepository == null )
|
if ( localRepository == null )
|
||||||
|
@ -99,9 +102,17 @@ public class DependenciesTask
|
||||||
throw new BuildException( "Reference ID " + pathId + " already exists" );
|
throw new BuildException( "Reference ID " + pathId + " already exists" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( getProject().getReference( filesetId ) != null )
|
||||||
|
{
|
||||||
|
throw new BuildException( "Reference ID " + filesetId + " already exists" );
|
||||||
|
}
|
||||||
|
|
||||||
FileList fileList = new FileList();
|
FileList fileList = new FileList();
|
||||||
fileList.setDir( localRepository.getLocation() );
|
fileList.setDir( localRepository.getLocation() );
|
||||||
|
|
||||||
|
FileSet fileSet = new FileSet();
|
||||||
|
fileSet.setDir( fileList.getDir( getProject() ) );
|
||||||
|
|
||||||
for ( Iterator i = result.getArtifacts().values().iterator(); i.hasNext(); )
|
for ( Iterator i = result.getArtifacts().values().iterator(); i.hasNext(); )
|
||||||
{
|
{
|
||||||
Artifact artifact = (Artifact) i.next();
|
Artifact artifact = (Artifact) i.next();
|
||||||
|
@ -119,13 +130,23 @@ public class DependenciesTask
|
||||||
file.setName( filename );
|
file.setName( filename );
|
||||||
|
|
||||||
fileList.addConfiguredFile( file );
|
fileList.addConfiguredFile( file );
|
||||||
|
|
||||||
|
fileSet.createInclude().setName( filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( pathId != null )
|
||||||
|
{
|
||||||
Path path = new Path( getProject() );
|
Path path = new Path( getProject() );
|
||||||
path.addFilelist( fileList );
|
path.addFilelist( fileList );
|
||||||
getProject().addReference( pathId, path );
|
getProject().addReference( pathId, path );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( filesetId != null )
|
||||||
|
{
|
||||||
|
getProject().addReference( filesetId, fileSet );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private List createRemoteArtifactRepositories()
|
private List createRemoteArtifactRepositories()
|
||||||
{
|
{
|
||||||
List list = new ArrayList();
|
List list = new ArrayList();
|
||||||
|
@ -181,4 +202,14 @@ public class DependenciesTask
|
||||||
{
|
{
|
||||||
this.pathId = pathId;
|
this.pathId = pathId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFilesetId()
|
||||||
|
{
|
||||||
|
return filesetId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFilesetId( String filesetId )
|
||||||
|
{
|
||||||
|
this.filesetId = filesetId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue