mirror of https://github.com/apache/maven.git
scaffolding for remote transformation
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163677 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2727721b11
commit
701911f219
|
@ -66,7 +66,7 @@ public class DefaultArtifactHandlerManager
|
|||
for ( Iterator i = artifactTransformations.iterator(); i.hasNext(); )
|
||||
{
|
||||
ArtifactTransformation transform = (ArtifactTransformation) i.next();
|
||||
// TODO: perform transformation
|
||||
artifact = transform.transformRemoteArtifact( artifact, remoteRepository );
|
||||
}
|
||||
|
||||
return remoteRepository.pathOf( artifact );
|
||||
|
@ -79,7 +79,6 @@ public class DefaultArtifactHandlerManager
|
|||
{
|
||||
ArtifactTransformation transform = (ArtifactTransformation) i.next();
|
||||
artifact = transform.transformLocalArtifact( artifact, localRepository );
|
||||
// TODO: perform transformation
|
||||
}
|
||||
|
||||
return localRepository.getBasedir() + "/" + localRepository.pathOf( artifact );
|
||||
|
|
|
@ -158,6 +158,7 @@ public class DefaultWagonManager
|
|||
|
||||
wagon.connect( repository, getProxy( repository.getProtocol() ) );
|
||||
|
||||
// TODO: should we avoid doing the transforms on this every time, and instead transform outside the loop?
|
||||
String remotePath = artifactHandlerManager.getRemoteRepositoryArtifactPath( artifact, repository );
|
||||
|
||||
wagon.get( remotePath, temp );
|
||||
|
|
|
@ -36,4 +36,13 @@ public interface ArtifactTransformation
|
|||
* @return The transformed Artifact
|
||||
*/
|
||||
Artifact transformLocalArtifact( Artifact artifact, ArtifactRepository localRepository );
|
||||
|
||||
/**
|
||||
* Take in a artifact and return the transformed artifact for locating in the remote repository. If no
|
||||
* transformation has occured the original artifact is returned.
|
||||
*
|
||||
* @param artifact Artifact to be transformed.
|
||||
* @return The transformed Artifact
|
||||
*/
|
||||
Artifact transformRemoteArtifact( Artifact artifact, ArtifactRepository remoteRepository );
|
||||
}
|
|
@ -30,7 +30,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
|
|||
public class SnapshotTransformation
|
||||
implements ArtifactTransformation
|
||||
{
|
||||
/*
|
||||
/* TODO: use and remove
|
||||
public Artifact transform( Artifact artifact, ArtifactRepository localRepository, List repositories,
|
||||
Map parameters )
|
||||
throws Exception
|
||||
|
@ -187,7 +187,7 @@ public class SnapshotTransformation
|
|||
*/
|
||||
public Artifact transformLocalArtifact( Artifact artifact, ArtifactRepository localRepository )
|
||||
{
|
||||
if ( isSnapshot( artifact ) && "pom".equals( artifact.getType() ) )
|
||||
if ( shouldProcessArtifact( artifact ) )
|
||||
{
|
||||
// only store the snapshot-version-local.txt file for POMs as every file has an associated POM
|
||||
ArtifactMetadata metadata = SnapshotArtifactMetadata.createLocalSnapshotMetadata( artifact );
|
||||
|
@ -196,6 +196,20 @@ public class SnapshotTransformation
|
|||
return artifact;
|
||||
}
|
||||
|
||||
public Artifact transformRemoteArtifact( Artifact artifact, ArtifactRepository remoteRepository )
|
||||
{
|
||||
if ( shouldProcessArtifact( artifact ) )
|
||||
{
|
||||
// TODO: implement
|
||||
}
|
||||
return artifact;
|
||||
}
|
||||
|
||||
private static boolean shouldProcessArtifact( Artifact artifact )
|
||||
{
|
||||
return isSnapshot( artifact ) && "pom".equals( artifact.getType() );
|
||||
}
|
||||
|
||||
private static boolean isSnapshot( Artifact artifact )
|
||||
{
|
||||
return artifact.getVersion().endsWith( "SNAPSHOT" );
|
||||
|
|
Loading…
Reference in New Issue