cstamas commented on a change in pull request #46:
URL: https://github.com/apache/maven-plugin-tools/pull/46#discussion_r734554880
##########
File path:
maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScanner.java
##########
@@ -118,21 +156,38 @@ public void populatePluginDescriptor( PluginToolsRequest
request )
}
}
- /**
- * Gets the name of the active extractors.
- *
- * @return A Set containing the names of the active extractors.
- */
- protected Set<String> getActiveExtractors()
+ private List<MojoDescriptorExtractor> getOrderedExtractors() throws
ExtractionException
{
- Set<String> result = activeExtractors;
+ Set<String> extractors = activeExtractors;
- if ( result == null )
+ if ( extractors == null )
{
- result = new HashSet<>( mojoDescriptorExtractors.keySet() );
+ extractors = new HashSet<>( mojoDescriptorExtractors.keySet() );
+ }
+
+ ArrayList<MojoDescriptorExtractor> orderedExtractors = new
ArrayList<>();
+ for ( String extractorId : extractors )
+ {
+ MojoDescriptorExtractor extractor = mojoDescriptorExtractors.get(
extractorId );
+
+ if ( extractor == null )
+ {
+ throw new ExtractionException( "No mojo extractor with '" +
extractorId + "' id." );
+ }
+
+ orderedExtractors.add( extractor );
}
- return result;
+ Collections.sort( orderedExtractors, new
Comparator<MojoDescriptorExtractor>()
+ {
+ @Override
+ public int compare( final MojoDescriptorExtractor o1, final
MojoDescriptorExtractor o2 )
+ {
+ return o1.getGroupKey().compareTo( o2.getGroupKey() );
+ }
+ } );
Review comment:
Actually yes, would simplify things
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]