diff options
author | Olivier Lamy <olamy@apache.org> | 2014-04-01 01:45:38 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2014-04-01 01:45:38 +0000 |
commit | 638f9baba802e1d83e445a974b063bf505890b2e (patch) | |
tree | 6f04e1da23ffac28d1e842a2150d22dac1c43ff7 /archiva-modules | |
parent | b2c8f9e299c21b0a6659966da9e9c0011cde9660 (diff) | |
download | archiva-638f9baba802e1d83e445a974b063bf505890b2e.tar.gz archiva-638f9baba802e1d83e445a974b063bf505890b2e.zip |
fix jdk1.8 build
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1583508 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r-- | archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriter.java | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriter.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriter.java index 535be967e..ab47e78c1 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriter.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriter.java @@ -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() ); + } + } } |