Author: vbaranov
Date: 2008-03-19 08:13:13 -0400 (Wed, 19 Mar 2008)
New Revision: 6940
Modified:
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
Log:
http://jira.jboss.com/jira/browse/RF-2526
Modified:
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
===================================================================
---
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java 2008-03-19
11:28:43 UTC (rev 6939)
+++
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java 2008-03-19
12:13:13 UTC (rev 6940)
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -252,7 +253,7 @@
if (null != library.getTaglibs() && library.getTaglibs().length > 0) {
for (int i = 0; i < library.getTaglibs().length; i++) {
Taglib taglib = library.getTaglibs()[i];
- List taglibModels;
+ List<Model> taglibModels;
if (taglib.getIncludeModules() == null
&& taglib.getExcludeModules() == null) {
taglibModels = models;
@@ -280,6 +281,27 @@
}
}
}
+ // sort taglib models by artifactIds in ASC order
+ Collections.sort(taglibModels, new Comparator<Model>() {
+ /**
+ * Compares two <code>Model</code> objects by artifactIds
+ * for sorting in ASC order
+ * @param m1 - model object
+ * @param m2 - model object
+ * @return result of comparing
+ */
+ public int compare(Model m1, Model m2) {
+ // check incoming parameters for null
+ if ((m1 == null) || (m1.getArtifactId() == null)) {
+ return -1;
+ } else
+ if ((m2 == null) || (m2.getArtifactId() == null)) {
+ return 1;
+ }
+
+ return m1.getArtifactId().compareTo(m2.getArtifactId());
+ }
+ });
generateTaglib(taglibModels, taglib);
}
} else {