diff --git a/maven-artifact-ant/pom.xml b/maven-artifact-ant/pom.xml
new file mode 100755
index 0000000000..7c45889baa
--- /dev/null
+++ b/maven-artifact-ant/pom.xml
@@ -0,0 +1,31 @@
+
+ 4.0.0
+ org.apache.maven
+ maven-artifact-ant
+ jar
+ 1.0-SNAPSHOT
+
+
+ ant
+ ant
+ 1.6.2
+
+
+ org.apache.maven
+ maven-artifact
+ 2.0-alpha-1
+
+
+
+ org.apache.maven
+ maven-core
+ 2.0-alpha-1
+
+
+ junit
+ junit
+ 3.8.1
+ test
+
+
+
diff --git a/maven-artifact-ant/sample.build.xml b/maven-artifact-ant/sample.build.xml
new file mode 100644
index 0000000000..41ae76c9e1
--- /dev/null
+++ b/maven-artifact-ant/sample.build.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java
new file mode 100755
index 0000000000..de3d965d60
--- /dev/null
+++ b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java
@@ -0,0 +1,100 @@
+package org.apache.maven.artifact.ant;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.embed.Embedder;
+
+/**
+ * Base class for artifact tasks.
+ *
+ * @author Brett Porter
+ * @version $Id$
+ */
+public abstract class AbstractArtifactTask
+ extends Task
+{
+ private Embedder embedder;
+
+ protected ArtifactRepository createArtifactRepository( LocalRepository repository )
+ {
+ return createArtifactRepository( "local", "file://" + repository.getLocation(), repository.getLayout() );
+ }
+
+ protected ArtifactRepository createArtifactRepository( RemoteRepository repository )
+ {
+ return createArtifactRepository( "remote", repository.getUrl(), repository.getLayout() );
+ }
+
+ private ArtifactRepository createArtifactRepository( String id, String url, String layout )
+ {
+ ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
+ layout );
+ return new ArtifactRepository( id, url, repositoryLayout );
+ }
+
+ protected Object lookup( String role )
+ {
+ try
+ {
+ return getEmbedder().lookup( role );
+ }
+ catch ( ComponentLookupException e )
+ {
+ throw new BuildException( "Unable to find component: " + role, e );
+ }
+ }
+
+ private Object lookup( String role, String roleHint )
+ {
+ try
+ {
+ return getEmbedder().lookup( role, roleHint );
+ }
+ catch ( ComponentLookupException e )
+ {
+ throw new BuildException( "Unable to find component: " + role + "[" + roleHint + "]", e );
+ }
+ }
+
+ private synchronized Embedder getEmbedder()
+ {
+ if ( embedder == null )
+ {
+ embedder = (Embedder) getProject().getReference( Embedder.class.getName() );
+
+ if ( embedder == null )
+ {
+ embedder = new Embedder();
+ try
+ {
+ embedder.start();
+ }
+ catch ( Exception e )
+ {
+ throw new BuildException( "Unable to start embedder", e );
+ }
+ getProject().addReference( Embedder.class.getName(), embedder );
+ }
+ }
+ return embedder;
+ }
+}
diff --git a/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/AntDownloadMonitor.java b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/AntDownloadMonitor.java
new file mode 100755
index 0000000000..78e758cb8f
--- /dev/null
+++ b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/AntDownloadMonitor.java
@@ -0,0 +1,67 @@
+package org.apache.maven.artifact.ant;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.wagon.events.TransferEvent;
+import org.apache.maven.wagon.events.TransferListener;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectComponent;
+
+/**
+ * Log wagon events in the ant tasks
+ *
+ * @author Brett Porter
+ * @version $Id$
+ */
+public class AntDownloadMonitor
+ extends ProjectComponent
+ implements TransferListener
+{
+ public void debug( String s )
+ {
+ log( s, Project.MSG_DEBUG );
+ }
+
+ public void transferCompleted( TransferEvent event )
+ {
+ }
+
+ public void transferError( TransferEvent event )
+ {
+ log( event.getException().getMessage(), Project.MSG_ERR );
+ }
+
+ public void transferInitiated( TransferEvent event )
+ {
+ String message = event.getRequestType() == TransferEvent.REQUEST_PUT ? "Uploading" : "Downloading";
+
+ log( message + ": " + event.getResource().getName() );
+ }
+
+ public void transferProgress( TransferEvent event, byte[] bytes, int i )
+ {
+ }
+
+ public void transferStarted( TransferEvent event )
+ {
+ long contentLength = event.getResource().getContentLength();
+ if ( contentLength > 0 )
+ {
+ log( "Transferring " + ( contentLength / 1024 ) + "K" );
+ }
+ }
+}
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
new file mode 100755
index 0000000000..85e51181d1
--- /dev/null
+++ b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java
@@ -0,0 +1,179 @@
+package org.apache.maven.artifact.ant;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.MavenMetadataSource;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.manager.WagonManager;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.layout.ArtifactPathFormatException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.FileList;
+import org.apache.tools.ant.types.Path;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Dependencies task, using maven-artifact.
+ *
+ * @author Brett Porter
+ * @version $Id$
+ */
+public class DependenciesTask
+ extends AbstractArtifactTask
+{
+ private List dependencies = new ArrayList();
+
+ private LocalRepository localRepository;
+
+ private List remoteRepositories = new ArrayList();
+
+ private String pathId;
+
+ public void execute()
+ {
+ ArtifactRepository localRepo = createArtifactRepository( localRepository );
+
+ ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
+
+ Set artifacts = new HashSet();
+ for ( Iterator i = dependencies.iterator(); i.hasNext(); )
+ {
+ Dependency dependency = (Dependency) i.next();
+ Artifact a = factory.createArtifact( dependency.getGroupId(), dependency.getArtifactId(),
+ dependency.getVersion(), dependency.getScope(), dependency.getType(),
+ null );
+ artifacts.add( a );
+ }
+
+ ArtifactResolver resolver = (ArtifactResolver) lookup( ArtifactResolver.ROLE );
+ MavenMetadataSource metadataSource = new MavenMetadataSource( resolver, (MavenProjectBuilder) lookup(
+ MavenProjectBuilder.ROLE ) );
+
+ log( "Resolving dependencies..." );
+
+ WagonManager wagonManager = (WagonManager) lookup( WagonManager.ROLE );
+ wagonManager.setDownloadMonitor( new AntDownloadMonitor() );
+
+ ArtifactResolutionResult result;
+ try
+ {
+ result =
+ resolver.resolveTransitively( artifacts, createRemoteArtifactRepositories(), localRepo, metadataSource );
+ }
+ catch ( ArtifactResolutionException e )
+ {
+ throw new BuildException( "Unable to resolve artifact", e );
+ }
+
+ if ( getProject().getReference( pathId ) != null )
+ {
+ throw new BuildException( "Reference ID " + pathId + " already exists" );
+ }
+
+ FileList fileList = new FileList();
+ fileList.setDir( localRepository.getLocation() );
+
+ for ( Iterator i = result.getArtifacts().values().iterator(); i.hasNext(); )
+ {
+ Artifact artifact = (Artifact) i.next();
+ String filename = null;
+ try
+ {
+ filename = localRepo.pathOf( artifact );
+ }
+ catch ( ArtifactPathFormatException e )
+ {
+ throw new BuildException( "Unable to determine path to artifact: " + artifact );
+ }
+
+ FileList.FileName file = new FileList.FileName();
+ file.setName( filename );
+
+ fileList.addConfiguredFile( file );
+ }
+
+ Path path = new Path( getProject() );
+ path.addFilelist( fileList );
+ getProject().addReference( pathId, path );
+ }
+
+ private List createRemoteArtifactRepositories()
+ {
+ List list = new ArrayList();
+ for ( Iterator i = getRemoteRepositories().iterator(); i.hasNext(); )
+ {
+ list.add( createArtifactRepository( (RemoteRepository) i.next() ) );
+ }
+ return list;
+ }
+
+ public List getRemoteRepositories()
+ {
+ if ( remoteRepositories.isEmpty() )
+ {
+ RemoteRepository remoteRepository = new RemoteRepository();
+ remoteRepository.setUrl( "http://repo1.maven.org/maven2" );
+ remoteRepositories.add( remoteRepository );
+ }
+ return remoteRepositories;
+ }
+
+ public void addRemoteRepository( RemoteRepository remoteRepository )
+ {
+ remoteRepositories.add( remoteRepository );
+ }
+
+ public List getDependencies()
+ {
+ return dependencies;
+ }
+
+ public void addDependency( Dependency dependency )
+ {
+ dependencies.add( dependency );
+ }
+
+ public LocalRepository getLocalRepository()
+ {
+ return localRepository;
+ }
+
+ public void addLocalRepository( LocalRepository localRepository )
+ {
+ this.localRepository = localRepository;
+ }
+
+ public String getPathId()
+ {
+ return pathId;
+ }
+
+ public void setPathId( String pathId )
+ {
+ this.pathId = pathId;
+ }
+}
diff --git a/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/Dependency.java b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/Dependency.java
new file mode 100755
index 0000000000..31ff82dba1
--- /dev/null
+++ b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/Dependency.java
@@ -0,0 +1,87 @@
+package org.apache.maven.artifact.ant;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * TODO: describe
+ *
+ * @author Brett Porter
+ * @version $Id$
+ */
+public class Dependency
+{
+ private String groupId;
+ private String artifactId;
+ private String version;
+ private String scope = "compile";
+ private String type = "jar";
+
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ public void setGroupId( String groupId )
+ {
+ this.groupId = groupId;
+ }
+
+ public String getArtifactId()
+ {
+ return artifactId;
+ }
+
+ public void setArtifactId( String artifactId )
+ {
+ this.artifactId = artifactId;
+ }
+
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion( String version )
+ {
+ this.version = version;
+ }
+
+ public String getScope()
+ {
+ return scope;
+ }
+
+ public void setScope( String scope )
+ {
+ this.scope = scope;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType( String type )
+ {
+ this.type = type;
+ }
+
+ public String toString()
+ {
+ return groupId + ":" + artifactId + ":" + version + ":" + type + " [scope = " + scope + "]";
+ }
+}
diff --git a/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DeployTask.java b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DeployTask.java
new file mode 100755
index 0000000000..2d7ce309b8
--- /dev/null
+++ b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DeployTask.java
@@ -0,0 +1,124 @@
+package org.apache.maven.artifact.ant;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.installer.ArtifactInstaller;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
+import org.apache.maven.artifact.deployer.ArtifactDeployer;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.metadata.MavenMetadata;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.tools.ant.BuildException;
+
+import java.io.File;
+
+/**
+ * Deploy task, using maven-artifact.
+ *
+ * @author Brett Porter
+ * @version $Id$
+ */
+public class DeployTask
+ extends AbstractArtifactTask
+{
+ private Pom pom;
+
+ private LocalRepository localRepository;
+
+ private RemoteRepository remoteRepository;
+
+ private File file;
+
+ public void execute()
+ {
+ ArtifactRepository localRepo = createArtifactRepository( localRepository );
+ pom.initialise( (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE ), localRepo );
+
+ ArtifactRepository deploymentRepository = createArtifactRepository( remoteRepository );
+
+ // Deploy the POM
+ Artifact artifact = new DefaultArtifact( pom.getGroupId(), pom.getArtifactId(), pom.getVersion(),
+ pom.getPackaging() );
+ boolean isPomArtifact = "pom".equals( pom.getPackaging() );
+ if ( !isPomArtifact )
+ {
+ ArtifactMetadata metadata = new MavenMetadata( artifact, pom.getFile() );
+ artifact.addMetadata( metadata );
+ }
+
+ ArtifactDeployer deployer = (ArtifactDeployer) lookup( ArtifactDeployer.ROLE );
+ try
+ {
+ if ( !isPomArtifact )
+ {
+ deployer.deploy( pom.getBuild().getDirectory(), artifact, deploymentRepository, localRepo );
+ }
+ else
+ {
+ deployer.deploy( pom.getFile(), artifact, deploymentRepository, localRepo );
+ }
+ }
+ catch ( ArtifactDeploymentException e )
+ {
+ // TODO: deployment exception that does not give a trace
+ throw new BuildException( "Error deploying artifact", e );
+ }
+ }
+
+ public Pom getPom()
+ {
+ return pom;
+ }
+
+ public void addPom( Pom pom )
+ {
+ this.pom = pom;
+ }
+
+ public LocalRepository getLocalRepository()
+ {
+ return localRepository;
+ }
+
+ public void addLocalRepository( LocalRepository localRepository )
+ {
+ this.localRepository = localRepository;
+ }
+
+ public RemoteRepository getRemoteRepository()
+ {
+ return remoteRepository;
+ }
+
+ public void addRemoteRepository( RemoteRepository remoteRepository )
+ {
+ this.remoteRepository = remoteRepository;
+ }
+
+ public File getFile()
+ {
+ return file;
+ }
+
+ public void setFile( File file )
+ {
+ this.file = file;
+ }
+}
diff --git a/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/InstallTask.java b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/InstallTask.java
new file mode 100755
index 0000000000..7ccd20df16
--- /dev/null
+++ b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/InstallTask.java
@@ -0,0 +1,110 @@
+package org.apache.maven.artifact.ant;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.installer.ArtifactInstallationException;
+import org.apache.maven.artifact.installer.ArtifactInstaller;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.metadata.MavenMetadata;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.tools.ant.BuildException;
+
+import java.io.File;
+
+/**
+ * Install task, using maven-artifact.
+ *
+ * @author Brett Porter
+ * @version $Id$
+ * @todo should be able to incorporate into the install mojo?
+ */
+public class InstallTask
+ extends AbstractArtifactTask
+{
+ private Pom pom;
+
+ private LocalRepository localRepository;
+
+ private File file;
+
+ public void execute()
+ {
+ ArtifactRepository localRepo = createArtifactRepository( localRepository );
+ pom.initialise( (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE ), localRepo );
+
+ Artifact artifact = new DefaultArtifact( pom.getGroupId(), pom.getArtifactId(), pom.getVersion(),
+ pom.getPackaging() );
+
+ boolean isPomArtifact = "pom".equals( pom.getPackaging() );
+ if ( !isPomArtifact )
+ {
+ ArtifactMetadata metadata = new MavenMetadata( artifact, pom.getFile() );
+ artifact.addMetadata( metadata );
+ }
+
+ ArtifactInstaller installer = (ArtifactInstaller) lookup( ArtifactInstaller.ROLE );
+ try
+ {
+ if ( !isPomArtifact )
+ {
+ installer.install( pom.getBuild().getDirectory(), artifact, localRepo );
+ }
+ else
+ {
+ installer.install( pom.getFile(), artifact, localRepo );
+ }
+ }
+ catch ( ArtifactInstallationException e )
+ {
+ // TODO: install exception that does not give a trace
+ throw new BuildException( "Error installing artifact", e );
+ }
+ }
+
+ public Pom getPom()
+ {
+ return pom;
+ }
+
+ public void addPom( Pom pom )
+ {
+ this.pom = pom;
+ }
+
+ public LocalRepository getLocalRepository()
+ {
+ return localRepository;
+ }
+
+ public void addLocalRepository( LocalRepository localRepository )
+ {
+ this.localRepository = localRepository;
+ }
+
+ public File getFile()
+ {
+ return file;
+ }
+
+ public void setFile( File file )
+ {
+ this.file = file;
+ }
+}
diff --git a/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/LocalRepository.java b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/LocalRepository.java
new file mode 100755
index 0000000000..4f69dc1758
--- /dev/null
+++ b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/LocalRepository.java
@@ -0,0 +1,41 @@
+package org.apache.maven.artifact.ant;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+
+/**
+ * Local repository type.
+ *
+ * @author Brett Porter
+ * @version $Id$
+ */
+public class LocalRepository
+ extends Repository
+{
+ private File location;
+
+ public File getLocation()
+ {
+ return ( (LocalRepository) getInstance() ).location;
+ }
+
+ public void setLocation( File location )
+ {
+ this.location = location;
+ }
+}
diff --git a/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/Pom.java b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/Pom.java
new file mode 100755
index 0000000000..1b12f37e69
--- /dev/null
+++ b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/Pom.java
@@ -0,0 +1,238 @@
+package org.apache.maven.artifact.ant;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.CiManagement;
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.IssueManagement;
+import org.apache.maven.model.Organization;
+import org.apache.maven.model.Reports;
+import org.apache.maven.model.Scm;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.ProjectComponent;
+
+import java.io.File;
+
+/**
+ * A POM.
+ *
+ * @author Brett Porter
+ * @version $Id$
+ */
+public class Pom
+ extends ProjectComponent
+{
+ private String refid;
+
+ private MavenProject mavenProject;
+
+ private File file;
+
+ public String getRefid()
+ {
+ return refid;
+ }
+
+ public void setRefid( String refid )
+ {
+ this.refid = refid;
+ }
+
+ protected Pom getInstance()
+ {
+ Pom instance = this;
+ if ( refid != null )
+ {
+ instance = (Pom) getProject().getReference( refid );
+ }
+ return instance;
+ }
+
+ public File getFile()
+ {
+ return getInstance().file;
+ }
+
+ public void setFile( File file )
+ throws Exception
+ {
+ this.file = file;
+ }
+
+ void initialise( MavenProjectBuilder builder, ArtifactRepository localRepository )
+ {
+ if ( file != null )
+ {
+ try
+ {
+ mavenProject = builder.build( file, localRepository );
+ }
+ catch ( ProjectBuildingException e )
+ {
+ throw new BuildException( "Unable to build project: " + file, e );
+ }
+ }
+ else if ( refid != null )
+ {
+ getInstance().initialise( builder, localRepository );
+ }
+ }
+
+ private MavenProject getMavenProject()
+ {
+ return getInstance().mavenProject;
+ }
+
+ public String getArtifactId()
+ {
+ return getMavenProject().getArtifactId();
+ } //-- String getArtifactId()
+
+ public Build getBuild()
+ {
+ return getMavenProject().getBuild();
+ } //-- Build getBuild()
+
+ public CiManagement getCiManagement()
+ {
+ return getMavenProject().getCiManagement();
+ } //-- CiManagement getCiManagement()
+
+ public java.util.List getContributors()
+ {
+ return getMavenProject().getContributors();
+ } //-- java.util.List getContributors()
+
+ public java.util.List getDependencies()
+ {
+ return getMavenProject().getDependencies();
+ } //-- java.util.List getDependencies()
+
+ public DependencyManagement getDependencyManagement()
+ {
+ return getMavenProject().getDependencyManagement();
+ } //-- DependencyManagement getDependencyManagement()
+
+ public String getDescription()
+ {
+ return getMavenProject().getDescription();
+ } //-- String getDescription()
+
+ public java.util.List getDevelopers()
+ {
+ return getMavenProject().getDevelopers();
+ } //-- java.util.List getDevelopers()
+
+ public DistributionManagement getDistributionManagement()
+ {
+ return getMavenProject().getDistributionManagement();
+ } //-- DistributionManagement getDistributionManagement()
+
+ public String getGroupId()
+ {
+ return getMavenProject().getGroupId();
+ } //-- String getGroupId()
+
+ public String getInceptionYear()
+ {
+ return getMavenProject().getInceptionYear();
+ } //-- String getInceptionYear()
+
+ public IssueManagement getIssueManagement()
+ {
+ return getMavenProject().getIssueManagement();
+ } //-- IssueManagement getIssueManagement()
+
+ public java.util.List getLicenses()
+ {
+ return getMavenProject().getLicenses();
+ } //-- java.util.List getLicenses()
+
+ public java.util.List getMailingLists()
+ {
+ return getMavenProject().getMailingLists();
+ } //-- java.util.List getMailingLists()
+
+ public String getModelVersion()
+ {
+ return getMavenProject().getModelVersion();
+ } //-- String getModelVersion()
+
+ public java.util.List getModules()
+ {
+ return getMavenProject().getModules();
+ } //-- java.util.List getModules()
+
+ public String getName()
+ {
+ return getMavenProject().getName();
+ } //-- String getName()
+
+ public Organization getOrganization()
+ {
+ return getMavenProject().getOrganization();
+ } //-- Organization getOrganization()
+
+ public String getPackaging()
+ {
+ return getMavenProject().getPackaging();
+ } //-- String getPackaging()
+
+/* TODO: requires newer maven-core
+ public java.util.List getPluginRepositories()
+ {
+ return getModel().getPluginRepositories();
+ } //-- java.util.List getPluginRepositories()
+*/
+
+ public Reports getReports()
+ {
+ return getMavenProject().getReports();
+ } //-- Reports getReports()
+
+ public java.util.List getRepositories()
+ {
+ return getMavenProject().getRepositories();
+ } //-- java.util.List getRepositories()
+
+ public Scm getScm()
+ {
+ return getMavenProject().getScm();
+ } //-- Scm getScm()
+
+ public String getUrl()
+ {
+ return getMavenProject().getUrl();
+ } //-- String getUrl()
+
+ public String getVersion()
+ {
+ return getMavenProject().getVersion();
+ } //-- String getVersion()
+
+ public String getId()
+ {
+ return getMavenProject().getId();
+ }
+
+}
diff --git a/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/RemoteRepository.java b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/RemoteRepository.java
new file mode 100755
index 0000000000..30e9a993f9
--- /dev/null
+++ b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/RemoteRepository.java
@@ -0,0 +1,38 @@
+package org.apache.maven.artifact.ant;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Remote repository type.
+ *
+ * @author Brett Porter
+ * @version $Id$
+ */
+public class RemoteRepository extends Repository
+{
+ private String url;
+
+ public String getUrl()
+ {
+ return ( (RemoteRepository) getInstance() ).url;
+ }
+
+ public void setUrl( String url )
+ {
+ this.url = url;
+ }
+}
diff --git a/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/Repository.java b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/Repository.java
new file mode 100755
index 0000000000..816f3d7352
--- /dev/null
+++ b/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/Repository.java
@@ -0,0 +1,62 @@
+package org.apache.maven.artifact.ant;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.tools.ant.ProjectComponent;
+
+/**
+ * Base class for a repository.
+ *
+ * @author Brett Porter
+ * @version $Id$
+ */
+public abstract class Repository extends ProjectComponent
+{
+ private String refid;
+
+ private String layout = "default";
+
+ public String getRefid()
+ {
+ return refid;
+ }
+
+ public void setRefid( String refid )
+ {
+ this.refid = refid;
+ }
+
+ protected Repository getInstance()
+ {
+ Repository instance = this;
+ if ( refid != null )
+ {
+ instance = (Repository) getProject().getReference( refid );
+ }
+ return instance;
+ }
+
+ public String getLayout()
+ {
+ return getInstance().layout;
+ }
+
+ public void setLayout( String layout )
+ {
+ this.layout = layout;
+ }
+}
diff --git a/maven-artifact-ant/src/main/resources/org/apache/maven/artifact/ant/antlib.xml b/maven-artifact-ant/src/main/resources/org/apache/maven/artifact/ant/antlib.xml
new file mode 100755
index 0000000000..faf29b551b
--- /dev/null
+++ b/maven-artifact-ant/src/main/resources/org/apache/maven/artifact/ant/antlib.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+