001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.maven.tools.plugin.extractor; 020 021import java.util.List; 022 023import org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException; 024import org.apache.maven.plugin.descriptor.MojoDescriptor; 025import org.apache.maven.tools.plugin.PluginToolsRequest; 026 027/** 028 * @author jdcasey 029 */ 030public interface MojoDescriptorExtractor { 031 /** 032 * Returns the "name" (id) of the extractor. 033 * 034 * @since 3.7.0 035 */ 036 String getName(); 037 038 /** 039 * Returns {@code true} if extractor is deprecated. 040 * 041 * @since 3.7.0 042 */ 043 boolean isDeprecated(); 044 045 /** 046 * Returns the {@link GroupKey} of extractor, as {@link org.apache.maven.tools.plugin.scanner.MojoScanner} will 047 * execute them grouped, and ordered within groups. Must never return {@code null}. 048 * 049 * @since 3.7.0 050 */ 051 GroupKey getGroupKey(); 052 053 /** 054 * Execute the mojo extraction. 055 * 056 * @param request The {@link PluginToolsRequest} containing information for the extraction process. 057 * @return a list of mojo descriptors. These may return HTML values for some fields. 058 * @throws ExtractionException if any 059 * @throws InvalidPluginDescriptorException if any 060 * @since 2.5 061 */ 062 List<MojoDescriptor> execute(PluginToolsRequest request) 063 throws ExtractionException, InvalidPluginDescriptorException; 064 065 /** 066 * The default implementation returns {@code null}. 067 * @return the required java version or {@code null} if unknown 068 * 069 * @since 3.8.0 070 */ 071 default String getRequiredJavaVersion() { 072 return null; 073 } 074}