Initial revision

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163962 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-04-18 04:12:34 +00:00
parent 81ac2805a4
commit 319c135c45
13 changed files with 1134 additions and 0 deletions

31
maven-artifact-ant/pom.xml Executable file
View File

@ -0,0 +1,31 @@
<model>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact-ant</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>2.0-alpha-1</version>
</dependency>
<!-- for project loading... -->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>2.0-alpha-1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</model>

View File

@ -0,0 +1,45 @@
<project name="foo" xmlns:artifact="antlib:org.apache.maven.artifact.ant" default="foo">
<target name="foo">
<!--
TODO...
Implementation:
- don't require everything in $ANT_HOME/lib (give example using typedef) - currently all of M2_HOME/lib needs to be in ANT_HOME/lib (ie maven-core's dependencies)
- need to decouple maven-artifact from plexus, or create an ant logger for plexus, then embed it in here
- need to decouple project loading from maven-core. Loading the model was not enough (no inheritence or super model)
Features:
- read .m2/settings.xml
- get dependencies from POM
-->
<artifact:localRepository id="local.repository" location="${basedir}/target/local-repo" layout="default" />
<artifact:remoteRepository id="deploy.repository" url="file://${basedir}/target/deployment-repo" layout="legacy" />
<artifact:pom file="pom.xml" id="maven.project" />
<!--
- TODO: would be nice to declare the POM inline, but I'd need to proxy all of the model objects
<artifact:pom id="maven.project">
<artifactId>...</artifactId>
</artifact:pom>
-->
<artifact:dependencies pathId="dependency.classpath">
<dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-2" />
<dependency groupId="plexus" artifactId="plexus-container-default" version="1.0-alpha-2" />
<localRepository refid="local.repository" />
</artifact:dependencies>
<artifact:install file="target/maven-artifact-ant-1.0-alpha-2-SNAPSHOT.jar">
<localRepository refid="local.repository" />
<pom refid="maven.project" />
</artifact:install>
<artifact:deploy file="target/maven-artifact-ant-1.0-alpha-2-SNAPSHOT.jar">
<localRepository refid="local.repository" />
<remoteRepository refid="deploy.repository" />
<pom refid="maven.project" />
</artifact:deploy>
</target>
</project>

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @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;
}
}

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @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" );
}
}
}

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @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;
}
}

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @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 + "]";
}
}

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @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;
}
}

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @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;
}
}

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @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;
}
}

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @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();
}
}

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @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;
}
}

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @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;
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<antlib>
<!-- Tasks -->
<typedef name="dependencies" classname="org.apache.maven.artifact.ant.DependenciesTask" />
<typedef name="install" classname="org.apache.maven.artifact.ant.InstallTask" />
<typedef name="deploy" classname="org.apache.maven.artifact.ant.DeployTask" />
<!-- Types -->
<typedef name="localRepository" classname="org.apache.maven.artifact.ant.LocalRepository" />
<typedef name="remoteRepository" classname="org.apache.maven.artifact.ant.RemoteRepository" />
<typedef name="pom" classname="org.apache.maven.artifact.ant.Pom" />
</antlib>