mirror of https://github.com/apache/archiva.git
fix jdk1.8 build
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1583508 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b2c8f9e299
commit
638f9baba8
|
@ -35,12 +35,13 @@ import java.io.File;
|
|||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* RepositoryMetadataWriter
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RepositoryMetadataWriter
|
||||
{
|
||||
|
@ -86,6 +87,10 @@ public class RepositoryMetadataWriter
|
|||
if ( CollectionUtils.isNotEmpty( metadata.getPlugins() ) )
|
||||
{
|
||||
Element plugins = root.addElement( "plugins" );
|
||||
|
||||
List<Plugin> pluginList = metadata.getPlugins();
|
||||
Collections.sort( pluginList, PluginComparator.INSTANCE );
|
||||
|
||||
for ( Plugin plugin : metadata.getPlugins() )
|
||||
{
|
||||
Element p = plugins.addElement( "plugin" );
|
||||
|
@ -95,9 +100,11 @@ public class RepositoryMetadataWriter
|
|||
}
|
||||
}
|
||||
|
||||
if ( CollectionUtils.isNotEmpty( metadata.getAvailableVersions() ) || StringUtils.isNotBlank(
|
||||
metadata.getReleasedVersion() ) || StringUtils.isNotBlank( metadata.getLatestVersion() )
|
||||
|| StringUtils.isNotBlank( metadata.getLastUpdated() ) || ( metadata.getSnapshotVersion() != null ) )
|
||||
if ( CollectionUtils.isNotEmpty( metadata.getAvailableVersions() ) //
|
||||
|| StringUtils.isNotBlank( metadata.getReleasedVersion() ) //
|
||||
|| StringUtils.isNotBlank( metadata.getLatestVersion() ) //
|
||||
|| StringUtils.isNotBlank( metadata.getLastUpdated() ) //
|
||||
|| ( metadata.getSnapshotVersion() != null ) )
|
||||
{
|
||||
Element versioning = root.addElement( "versioning" );
|
||||
|
||||
|
@ -145,4 +152,25 @@ public class RepositoryMetadataWriter
|
|||
|
||||
elem.addElement( elemName ).setText( text );
|
||||
}
|
||||
|
||||
private static class PluginComparator
|
||||
implements Comparator<Plugin>
|
||||
{
|
||||
private static final PluginComparator INSTANCE = new PluginComparator();
|
||||
|
||||
@Override
|
||||
public int compare( Plugin plugin, Plugin plugin2 )
|
||||
{
|
||||
if ( plugin.getPrefix() != null && plugin2.getPrefix() != null )
|
||||
{
|
||||
return plugin.getPrefix().compareTo( plugin2.getPrefix() );
|
||||
}
|
||||
if ( plugin.getName() != null && plugin2.getName() != null )
|
||||
{
|
||||
return plugin.getName().compareTo( plugin2.getName() );
|
||||
}
|
||||
// we assume artifactId is not null which sounds good :-)
|
||||
return plugin.getArtifactId().compareTo( plugin2.getArtifactId() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue