1 package org.apache.maven.plugins.plugin.descriptor_old;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.net.URI;
23
24 import org.apache.maven.plugin.descriptor.MojoDescriptor;
25 import org.apache.maven.plugin.descriptor.Parameter;
26 import org.apache.maven.plugin.descriptor.PluginDescriptor;
27 import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
28 import org.apache.maven.plugin.plugin.report_old.PluginReport;
29 import org.apache.maven.rtinfo.RuntimeInformation;
30 import org.apache.maven.tools.plugin.EnhancedParameterWrapper;
31 import org.codehaus.plexus.configuration.PlexusConfiguration;
32 import org.codehaus.plexus.configuration.PlexusConfigurationException;
33
34
35
36
37
38
39
40 @Deprecated
41 public class EnhancedPluginDescriptorBuilder extends PluginDescriptorBuilder
42 {
43 private final boolean requireAddingMissingParameterSinceField;
44
45 public EnhancedPluginDescriptorBuilder( RuntimeInformation rtInfo )
46 {
47 this( rtInfo.isMavenVersion( "[,3.3.9]" ) );
48 }
49
50 EnhancedPluginDescriptorBuilder( boolean requireAddingMissingParameterSinceField )
51 {
52 this.requireAddingMissingParameterSinceField = requireAddingMissingParameterSinceField;
53 }
54
55 @Override
56 public MojoDescriptor buildComponentDescriptor( PlexusConfiguration c, PluginDescriptor pluginDescriptor )
57 throws PlexusConfigurationException
58 {
59 MojoDescriptor mojoDescriptor = super.buildComponentDescriptor( c, pluginDescriptor );
60
61
62
63
64
65 PlexusConfiguration[] parameterConfigurations = c.getChild( "parameters" ).getChildren( "parameter" );
66
67 for ( PlexusConfiguration d : parameterConfigurations )
68 {
69 String parameterName = d.getChild( "name" ).getValue();
70
71 Parameter pd = mojoDescriptor.getParameterMap().get( parameterName );
72 if ( requireAddingMissingParameterSinceField )
73 {
74 addMissingParameterSinceField( pd, d );
75 }
76 PlexusConfiguration configTypeJavadocUrl = d.getChild( "typeJavadocUrl", false );
77 if ( configTypeJavadocUrl != null )
78 {
79 String parameterTypeJavadocUrl = configTypeJavadocUrl.getValue();
80 EnhancedParameterWrapper enhancedParameter = new EnhancedParameterWrapper( pd );
81 enhancedParameter.setTypeJavadocUrl( URI.create( parameterTypeJavadocUrl ) );
82 mojoDescriptor.getParameters().set( mojoDescriptor.getParameters().indexOf( pd ), enhancedParameter );
83 mojoDescriptor.getParameterMap().put( parameterName, enhancedParameter );
84 }
85 }
86 return mojoDescriptor;
87 }
88
89
90
91
92
93
94
95
96
97
98
99 void addMissingParameterSinceField( Parameter pd, PlexusConfiguration d ) throws PlexusConfigurationException
100 {
101 String parameterSince = d.getChild( "since" ).getValue();
102 pd.setSince( parameterSince );
103 }
104 }