cstamas commented on a change in pull request #46:
URL: https://github.com/apache/maven-plugin-tools/pull/46#discussion_r734712571
##########
File path:
maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScanner.java
##########
@@ -77,29 +82,60 @@ public void populatePluginDescriptor( PluginToolsRequest
request )
throws ExtractionException, InvalidPluginDescriptorException
{
Logger logger = getLogger();
- Set<String> activeExtractorsInternal = getActiveExtractors();
-
- logger.debug( "Using " + activeExtractorsInternal.size() + " mojo
extractors." );
int numMojoDescriptors = 0;
- for ( String extractorId : activeExtractorsInternal )
+ List<MojoDescriptorExtractor> orderedExtractors =
getOrderedExtractors();
+
+ logger.debug( "Using " + orderedExtractors.size() + " mojo
extractors." );
+
+ HashMap<String, Integer> groupStats = new HashMap<>();
+
+ for ( MojoDescriptorExtractor extractor : orderedExtractors )
{
- MojoDescriptorExtractor extractor = mojoDescriptorExtractors.get(
extractorId );
+ GroupKey groupKey = extractor.getGroupKey();
+ String extractorId = extractor.getName();
- if ( extractor == null )
+ if ( extractor.isDeprecated() )
{
- throw new ExtractionException( "No mojo extractor with '" +
extractorId + "' id." );
+ if ( groupStats.containsKey( groupKey.getGroup() )
+ && groupStats.get( groupKey.getGroup() ) != 0 )
+ {
+ logger.info( extractorId + " deprecated mojo extractor
skipped as group '" + groupKey.getGroup()
+ + "' already discovered " + groupStats.get(
groupKey.getGroup() )
+ + " mojo descriptor" + ( groupStats.get(
groupKey.getGroup() ) > 1 ? "s" : "" ) + "." );
+ continue; // if same group already found descriptors, skip
rest of the group
+ }
}
logger.debug( "Applying " + extractorId + " mojo extractor" );
List<MojoDescriptor> extractorDescriptors = extractor.execute(
request );
+ int extractorDescriptorsCount = extractorDescriptors.size();
+
logger.info( extractorId + " mojo extractor found " +
extractorDescriptors.size()
+ " mojo descriptor" + (
extractorDescriptors.size() > 1 ? "s" : "" ) + "." );
numMojoDescriptors += extractorDescriptors.size();
+ if ( extractor.isDeprecated() && extractorDescriptorsCount > 0 )
+ {
+ logger.warn( "" );
+ logger.warn( "Deprecated extractor extracted descriptors.
Upgrade your Mojo definitions." );
+ logger.warn( "" );
Review comment:
which is deprecated is shown now, and if Java group is in question, it
is said what should be used instead.
--
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]