mirror of https://github.com/apache/maven.git
o Restored runtime compatibility with plugins that implement custom ArtifactRepositoryLayouts (e.g. appassembler-maven-plugin). The method getId() was added in 3.0 and as such is not implemented by those custom impls. The refactoring done in r1073990 for MNG-4991 eventually made this discrepancy show up during plugin execution.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1075309 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2986a12cba
commit
089a9f8d5f
|
@ -180,7 +180,7 @@ public class DefaultArtifactRepository
|
|||
|
||||
sb.append( " id: " ).append( getId() ).append( "\n" );
|
||||
sb.append( " url: " ).append( getUrl() ).append( "\n" );
|
||||
sb.append( " layout: " ).append( layout != null ? layout.getId() : "none" ).append( "\n" );
|
||||
sb.append( " layout: " ).append( layout != null ? layout : "none" ).append( "\n" );
|
||||
|
||||
if ( snapshots != null )
|
||||
{
|
||||
|
|
|
@ -83,4 +83,11 @@ public class FlatRepositoryLayout
|
|||
{
|
||||
return pathOfRepositoryMetadata( metadata.getRemoteFilename() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return getId();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.net.MalformedURLException;
|
|||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.RepositoryUtils;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.settings.Mirror;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
|
@ -143,7 +144,7 @@ public class DefaultMirrorSelector
|
|||
|
||||
static boolean matchesLayout( ArtifactRepository repository, Mirror mirror )
|
||||
{
|
||||
return matchesLayout( repository.getLayout().getId(), mirror.getMirrorOfLayouts() );
|
||||
return matchesLayout( RepositoryUtils.getLayout( repository ), mirror.getMirrorOfLayouts() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -883,6 +883,12 @@ public class LegacyRepositorySystem
|
|||
return fallback.pathOfRemoteRepositoryMetadata( metadata );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return getId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ public class RepositoryUtils
|
|||
RemoteRepository result = null;
|
||||
if ( repo != null )
|
||||
{
|
||||
result = new RemoteRepository( repo.getId(), repo.getLayout().getId(), repo.getUrl() );
|
||||
result = new RemoteRepository( repo.getId(), getLayout( repo ), repo.getUrl() );
|
||||
result.setPolicy( true, toPolicy( repo.getSnapshots() ) );
|
||||
result.setPolicy( false, toPolicy( repo.getReleases() ) );
|
||||
result.setAuthentication( toAuthentication( repo.getAuthentication() ) );
|
||||
|
@ -207,6 +207,31 @@ public class RepositoryUtils
|
|||
return result;
|
||||
}
|
||||
|
||||
public static String getLayout( ArtifactRepository repo )
|
||||
{
|
||||
try
|
||||
{
|
||||
return repo.getLayout().getId();
|
||||
}
|
||||
catch ( LinkageError e )
|
||||
{
|
||||
/*
|
||||
* NOTE: getId() was added in 3.x and is as such not implemented by plugins compiled against 2.x APIs.
|
||||
*/
|
||||
String className = repo.getLayout().getClass().getSimpleName();
|
||||
if ( className.endsWith( "RepositoryLayout" ) )
|
||||
{
|
||||
String layout = className.substring( 0, className.length() - "RepositoryLayout".length() );
|
||||
if ( layout.length() > 0 )
|
||||
{
|
||||
layout = Character.toLowerCase( layout.charAt( 0 ) ) + layout.substring( 1 );
|
||||
return layout;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private static RepositoryPolicy toPolicy( ArtifactRepositoryPolicy policy )
|
||||
{
|
||||
RepositoryPolicy result = null;
|
||||
|
|
|
@ -136,7 +136,7 @@ public class MavenArtifactRepository
|
|||
|
||||
sb.append( " id: " ).append( getId() ).append( "\n" );
|
||||
sb.append( " url: " ).append( getUrl() ).append( "\n" );
|
||||
sb.append( " layout: " ).append( layout != null ? layout.getId() : "none" ).append( "\n" );
|
||||
sb.append( " layout: " ).append( layout != null ? layout : "none" ).append( "\n" );
|
||||
|
||||
if ( snapshots != null )
|
||||
{
|
||||
|
|
|
@ -103,4 +103,10 @@ public class DefaultRepositoryLayout
|
|||
return directory.replace( GROUP_SEPARATOR, PATH_SEPARATOR );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return getId();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue