View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   //  Generated by Modello Velocity from model.vm
3   //  template, any modifications will be overwritten.
4   // ==============================================================
5   package org.apache.maven.api.plugin.descriptor;
6   
7   import java.io.Serializable;
8   import java.util.ArrayList;
9   import java.util.Collection;
10  import java.util.Collections;
11  import java.util.HashMap;
12  import java.util.List;
13  import java.util.Map;
14  import java.util.Objects;
15  import java.util.Optional;
16  import java.util.Set;
17  import java.util.stream.Collectors;
18  import java.util.stream.Stream;
19  import org.apache.maven.api.annotations.Experimental;
20  import org.apache.maven.api.annotations.Generated;
21  import org.apache.maven.api.annotations.Immutable;
22  import org.apache.maven.api.annotations.Nonnull;
23  import org.apache.maven.api.annotations.NotThreadSafe;
24  import org.apache.maven.api.annotations.ThreadSafe;
25  
26  /**
27   * A Mojo description.
28   */
29  @Experimental
30  @Generated @ThreadSafe @Immutable
31  public class MojoDescriptor
32      implements Serializable
33  {
34      /**
35       * The goal name for the Mojo, that users will reference from the command line to execute the Mojo directly,
36       * or inside a POM in order to provide Mojo-specific configuration.
37       */
38      final String goal;
39      /**
40       * The description of this Mojo's functionality.
41       */
42      final String description;
43      /**
44       * The Mojo's fully-qualified class name (or script path in the case of non-Java Mojos).
45       */
46      final String implementation;
47      /**
48       * The implementation language for this Mojo (java, beanshell, etc.).
49       */
50      final String language;
51      /**
52       * Defines a default phase to bind a Mojo execution to if the user does not explicitly set a phase in the POM.
53       * <p><b>Note:</b> This will not automagically make a Mojo run when the plugin declaration is added
54       * to the POM. It merely enables the user to omit the {@code <phase>} element from the
55       * surrounding {@code <execution>} element.</p>
56       */
57      final String phase;
58      /**
59       * Reference the invocation phase of the Mojo.
60       */
61      final String executePhase;
62      /**
63       * Reference the invocation goal of the Mojo.
64       */
65      final String executeGoal;
66      /**
67       * 
68       */
69      final String executeLifecycle;
70      /**
71       * Flags this Mojo as requiring the dependencies in the specified class path to be resolved before it can
72       * execute: {@code compile}, {@code runtime}, {@code test},
73       * {@code compile+runtime} (since Maven 3.0) or {@code runtime+system} (since Maven 3.0)
74       */
75      final String dependencyResolution;
76      /**
77       * Flags this Mojo as requiring information about the dependencies that would make up the specified class
78       * path. As the name suggests, this is similar to requiresDependencyResolution and supports the same values.
79       * The important difference is this will not resolve the files for the dependencies, i.e. the artifacts
80       * associated with a Maven project can lack a file. As such, this annotation is meant for Mojos that only
81       * want to analyze the set of transitive dependencies, in particular during early lifecycle phases where
82       * full dependency resolution might fail due to projects which haven't been built yet.
83       */
84      final String dependencyCollection;
85      /**
86       * Flags this Mojo to be invoked directly only.
87       */
88      final boolean directInvocationOnly;
89      /**
90       * Flags this Mojo to require running inside of a project.
91       */
92      final boolean projectRequired;
93      /**
94       * Flags this Mojo to require online mode for its operation.
95       */
96      final boolean onlineRequired;
97      /**
98       * Flags this Mojo to run it in a multi-module way, i.e. aggregate the build with the set of projects
99       * listed as modules.
100      */
101     final boolean aggregator;
102     /**
103      * Specify that the Mojo is inherited.
104      */
105     final boolean inheritedByDefault;
106     /**
107      * Specify the version when the Mojo was added to the API. Similar to Javadoc since.
108      */
109     final String since;
110     /**
111      * Description with the reason of Mojo deprecation. Similar to Javadoc {@code @deprecated}
112      * This will trigger a warning when a user tries to use a Mojo marked as deprecated.
113      */
114     final String deprecated;
115     /**
116      * The configurator type to use when injecting parameter values into this Mojo. The value is normally deduced
117      * from the Mojo's implementation language, but can be specified to allow a custom ComponentConfigurator
118      * implementation to be used.
119      */
120     final String configurator;
121     /**
122      * 
123      */
124     final List<Parameter> parameters;
125     /**
126      * 
127      */
128     final List<Resolution> resolutions;
129     /**
130      * the id of the mojo, based on the goal name
131      */
132     final String id;
133     /**
134      * the full goal name
135      */
136     final String fullGoalName;
137 
138     /**
139       * Constructor for this class, to be called from its subclasses and {@link Builder}.
140       * @see Builder#build()
141       */
142     protected MojoDescriptor(Builder builder) {
143         this.goal = builder.goal != null ? builder.goal : (builder.base != null ? builder.base.goal : null);
144         this.description = builder.description != null ? builder.description : (builder.base != null ? builder.base.description : null);
145         this.implementation = builder.implementation != null ? builder.implementation : (builder.base != null ? builder.base.implementation : null);
146         this.language = builder.language != null ? builder.language : (builder.base != null ? builder.base.language : null);
147         this.phase = builder.phase != null ? builder.phase : (builder.base != null ? builder.base.phase : null);
148         this.executePhase = builder.executePhase != null ? builder.executePhase : (builder.base != null ? builder.base.executePhase : null);
149         this.executeGoal = builder.executeGoal != null ? builder.executeGoal : (builder.base != null ? builder.base.executeGoal : null);
150         this.executeLifecycle = builder.executeLifecycle != null ? builder.executeLifecycle : (builder.base != null ? builder.base.executeLifecycle : null);
151         this.dependencyResolution = builder.dependencyResolution != null ? builder.dependencyResolution : (builder.base != null ? builder.base.dependencyResolution : null);
152         this.dependencyCollection = builder.dependencyCollection != null ? builder.dependencyCollection : (builder.base != null ? builder.base.dependencyCollection : null);
153         this.directInvocationOnly = builder.directInvocationOnly != null ? builder.directInvocationOnly : (builder.base != null ? builder.base.directInvocationOnly : false);
154         this.projectRequired = builder.projectRequired != null ? builder.projectRequired : (builder.base != null ? builder.base.projectRequired : true);
155         this.onlineRequired = builder.onlineRequired != null ? builder.onlineRequired : (builder.base != null ? builder.base.onlineRequired : false);
156         this.aggregator = builder.aggregator != null ? builder.aggregator : (builder.base != null ? builder.base.aggregator : false);
157         this.inheritedByDefault = builder.inheritedByDefault != null ? builder.inheritedByDefault : (builder.base != null ? builder.base.inheritedByDefault : true);
158         this.since = builder.since != null ? builder.since : (builder.base != null ? builder.base.since : null);
159         this.deprecated = builder.deprecated != null ? builder.deprecated : (builder.base != null ? builder.base.deprecated : null);
160         this.configurator = builder.configurator != null ? builder.configurator : (builder.base != null ? builder.base.configurator : null);
161         this.parameters = ImmutableCollections.copy(builder.parameters != null ? builder.parameters : (builder.base != null ? builder.base.parameters : null));
162         this.resolutions = ImmutableCollections.copy(builder.resolutions != null ? builder.resolutions : (builder.base != null ? builder.base.resolutions : null));
163         this.id = builder.id != null ? builder.id : (builder.base != null ? builder.base.id : null);
164         this.fullGoalName = builder.fullGoalName != null ? builder.fullGoalName : (builder.base != null ? builder.base.fullGoalName : null);
165     }
166 
167     /**
168      * The goal name for the Mojo, that users will reference from the command line to execute the Mojo directly,
169      * or inside a POM in order to provide Mojo-specific configuration.
170      *
171      * @return a {@code String}
172      */
173     public String getGoal() {
174         return this.goal;
175     }
176 
177     /**
178      * The description of this Mojo's functionality.
179      *
180      * @return a {@code String}
181      */
182     public String getDescription() {
183         return this.description;
184     }
185 
186     /**
187      * The Mojo's fully-qualified class name (or script path in the case of non-Java Mojos).
188      *
189      * @return a {@code String}
190      */
191     public String getImplementation() {
192         return this.implementation;
193     }
194 
195     /**
196      * The implementation language for this Mojo (java, beanshell, etc.).
197      *
198      * @return a {@code String}
199      */
200     public String getLanguage() {
201         return this.language;
202     }
203 
204     /**
205      * Defines a default phase to bind a Mojo execution to if the user does not explicitly set a phase in the POM.
206      * <p><b>Note:</b> This will not automagically make a Mojo run when the plugin declaration is added
207      * to the POM. It merely enables the user to omit the {@code <phase>} element from the
208      * surrounding {@code <execution>} element.</p>
209      *
210      * @return a {@code String}
211      */
212     public String getPhase() {
213         return this.phase;
214     }
215 
216     /**
217      * Reference the invocation phase of the Mojo.
218      *
219      * @return a {@code String}
220      */
221     public String getExecutePhase() {
222         return this.executePhase;
223     }
224 
225     /**
226      * Reference the invocation goal of the Mojo.
227      *
228      * @return a {@code String}
229      */
230     public String getExecuteGoal() {
231         return this.executeGoal;
232     }
233 
234     /**
235      * 
236      *
237      * @return a {@code String}
238      */
239     public String getExecuteLifecycle() {
240         return this.executeLifecycle;
241     }
242 
243     /**
244      * Flags this Mojo as requiring the dependencies in the specified class path to be resolved before it can
245      * execute: {@code compile}, {@code runtime}, {@code test},
246      * {@code compile+runtime} (since Maven 3.0) or {@code runtime+system} (since Maven 3.0)
247      *
248      * @return a {@code String}
249      */
250     public String getDependencyResolution() {
251         return this.dependencyResolution;
252     }
253 
254     /**
255      * Flags this Mojo as requiring information about the dependencies that would make up the specified class
256      * path. As the name suggests, this is similar to requiresDependencyResolution and supports the same values.
257      * The important difference is this will not resolve the files for the dependencies, i.e. the artifacts
258      * associated with a Maven project can lack a file. As such, this annotation is meant for Mojos that only
259      * want to analyze the set of transitive dependencies, in particular during early lifecycle phases where
260      * full dependency resolution might fail due to projects which haven't been built yet.
261      *
262      * @return a {@code String}
263      */
264     public String getDependencyCollection() {
265         return this.dependencyCollection;
266     }
267 
268     /**
269      * Flags this Mojo to be invoked directly only.
270      *
271      * @return a {@code boolean}
272      */
273     public boolean isDirectInvocationOnly() {
274         return this.directInvocationOnly;
275     }
276 
277     /**
278      * Flags this Mojo to require running inside of a project.
279      *
280      * @return a {@code boolean}
281      */
282     public boolean isProjectRequired() {
283         return this.projectRequired;
284     }
285 
286     /**
287      * Flags this Mojo to require online mode for its operation.
288      *
289      * @return a {@code boolean}
290      */
291     public boolean isOnlineRequired() {
292         return this.onlineRequired;
293     }
294 
295     /**
296      * Flags this Mojo to run it in a multi-module way, i.e. aggregate the build with the set of projects
297      * listed as modules.
298      *
299      * @return a {@code boolean}
300      */
301     public boolean isAggregator() {
302         return this.aggregator;
303     }
304 
305     /**
306      * Specify that the Mojo is inherited.
307      *
308      * @return a {@code boolean}
309      */
310     public boolean isInheritedByDefault() {
311         return this.inheritedByDefault;
312     }
313 
314     /**
315      * Specify the version when the Mojo was added to the API. Similar to Javadoc since.
316      *
317      * @return a {@code String}
318      */
319     public String getSince() {
320         return this.since;
321     }
322 
323     /**
324      * Description with the reason of Mojo deprecation. Similar to Javadoc {@code @deprecated}
325      * This will trigger a warning when a user tries to use a Mojo marked as deprecated.
326      *
327      * @return a {@code String}
328      */
329     public String getDeprecated() {
330         return this.deprecated;
331     }
332 
333     /**
334      * The configurator type to use when injecting parameter values into this Mojo. The value is normally deduced
335      * from the Mojo's implementation language, but can be specified to allow a custom ComponentConfigurator
336      * implementation to be used.
337      *
338      * @return a {@code String}
339      */
340     public String getConfigurator() {
341         return this.configurator;
342     }
343 
344     /**
345      * 
346      *
347      * @return a {@code List<Parameter>}
348      */
349     @Nonnull
350     public List<Parameter> getParameters() {
351         return this.parameters;
352     }
353 
354     /**
355      * 
356      *
357      * @return a {@code List<Resolution>}
358      */
359     @Nonnull
360     public List<Resolution> getResolutions() {
361         return this.resolutions;
362     }
363 
364     /**
365      * the id of the mojo, based on the goal name
366      *
367      * @return a {@code String}
368      */
369     public String getId() {
370         return this.id;
371     }
372 
373     /**
374      * the full goal name
375      *
376      * @return a {@code String}
377      */
378     public String getFullGoalName() {
379         return this.fullGoalName;
380     }
381 
382     /**
383      * Creates a new builder with this object as the basis.
384      *
385      * @return a {@code Builder}
386      */
387     @Nonnull
388     public Builder with() {
389         return newBuilder(this);
390     }
391     /**
392      * Creates a new {@code MojoDescriptor} instance using the specified goal.
393      *
394      * @param goal the new {@code String} to use
395      * @return a {@code MojoDescriptor} with the specified goal
396      */
397     @Nonnull
398     public MojoDescriptor withGoal(String goal) {
399         return newBuilder(this, true).goal(goal).build();
400     }
401     /**
402      * Creates a new {@code MojoDescriptor} instance using the specified description.
403      *
404      * @param description the new {@code String} to use
405      * @return a {@code MojoDescriptor} with the specified description
406      */
407     @Nonnull
408     public MojoDescriptor withDescription(String description) {
409         return newBuilder(this, true).description(description).build();
410     }
411     /**
412      * Creates a new {@code MojoDescriptor} instance using the specified implementation.
413      *
414      * @param implementation the new {@code String} to use
415      * @return a {@code MojoDescriptor} with the specified implementation
416      */
417     @Nonnull
418     public MojoDescriptor withImplementation(String implementation) {
419         return newBuilder(this, true).implementation(implementation).build();
420     }
421     /**
422      * Creates a new {@code MojoDescriptor} instance using the specified language.
423      *
424      * @param language the new {@code String} to use
425      * @return a {@code MojoDescriptor} with the specified language
426      */
427     @Nonnull
428     public MojoDescriptor withLanguage(String language) {
429         return newBuilder(this, true).language(language).build();
430     }
431     /**
432      * Creates a new {@code MojoDescriptor} instance using the specified phase.
433      *
434      * @param phase the new {@code String} to use
435      * @return a {@code MojoDescriptor} with the specified phase
436      */
437     @Nonnull
438     public MojoDescriptor withPhase(String phase) {
439         return newBuilder(this, true).phase(phase).build();
440     }
441     /**
442      * Creates a new {@code MojoDescriptor} instance using the specified executePhase.
443      *
444      * @param executePhase the new {@code String} to use
445      * @return a {@code MojoDescriptor} with the specified executePhase
446      */
447     @Nonnull
448     public MojoDescriptor withExecutePhase(String executePhase) {
449         return newBuilder(this, true).executePhase(executePhase).build();
450     }
451     /**
452      * Creates a new {@code MojoDescriptor} instance using the specified executeGoal.
453      *
454      * @param executeGoal the new {@code String} to use
455      * @return a {@code MojoDescriptor} with the specified executeGoal
456      */
457     @Nonnull
458     public MojoDescriptor withExecuteGoal(String executeGoal) {
459         return newBuilder(this, true).executeGoal(executeGoal).build();
460     }
461     /**
462      * Creates a new {@code MojoDescriptor} instance using the specified executeLifecycle.
463      *
464      * @param executeLifecycle the new {@code String} to use
465      * @return a {@code MojoDescriptor} with the specified executeLifecycle
466      */
467     @Nonnull
468     public MojoDescriptor withExecuteLifecycle(String executeLifecycle) {
469         return newBuilder(this, true).executeLifecycle(executeLifecycle).build();
470     }
471     /**
472      * Creates a new {@code MojoDescriptor} instance using the specified dependencyResolution.
473      *
474      * @param dependencyResolution the new {@code String} to use
475      * @return a {@code MojoDescriptor} with the specified dependencyResolution
476      */
477     @Nonnull
478     public MojoDescriptor withDependencyResolution(String dependencyResolution) {
479         return newBuilder(this, true).dependencyResolution(dependencyResolution).build();
480     }
481     /**
482      * Creates a new {@code MojoDescriptor} instance using the specified dependencyCollection.
483      *
484      * @param dependencyCollection the new {@code String} to use
485      * @return a {@code MojoDescriptor} with the specified dependencyCollection
486      */
487     @Nonnull
488     public MojoDescriptor withDependencyCollection(String dependencyCollection) {
489         return newBuilder(this, true).dependencyCollection(dependencyCollection).build();
490     }
491     /**
492      * Creates a new {@code MojoDescriptor} instance using the specified directInvocationOnly.
493      *
494      * @param directInvocationOnly the new {@code boolean} to use
495      * @return a {@code MojoDescriptor} with the specified directInvocationOnly
496      */
497     @Nonnull
498     public MojoDescriptor withDirectInvocationOnly(boolean directInvocationOnly) {
499         return newBuilder(this, true).directInvocationOnly(directInvocationOnly).build();
500     }
501     /**
502      * Creates a new {@code MojoDescriptor} instance using the specified projectRequired.
503      *
504      * @param projectRequired the new {@code boolean} to use
505      * @return a {@code MojoDescriptor} with the specified projectRequired
506      */
507     @Nonnull
508     public MojoDescriptor withProjectRequired(boolean projectRequired) {
509         return newBuilder(this, true).projectRequired(projectRequired).build();
510     }
511     /**
512      * Creates a new {@code MojoDescriptor} instance using the specified onlineRequired.
513      *
514      * @param onlineRequired the new {@code boolean} to use
515      * @return a {@code MojoDescriptor} with the specified onlineRequired
516      */
517     @Nonnull
518     public MojoDescriptor withOnlineRequired(boolean onlineRequired) {
519         return newBuilder(this, true).onlineRequired(onlineRequired).build();
520     }
521     /**
522      * Creates a new {@code MojoDescriptor} instance using the specified aggregator.
523      *
524      * @param aggregator the new {@code boolean} to use
525      * @return a {@code MojoDescriptor} with the specified aggregator
526      */
527     @Nonnull
528     public MojoDescriptor withAggregator(boolean aggregator) {
529         return newBuilder(this, true).aggregator(aggregator).build();
530     }
531     /**
532      * Creates a new {@code MojoDescriptor} instance using the specified inheritedByDefault.
533      *
534      * @param inheritedByDefault the new {@code boolean} to use
535      * @return a {@code MojoDescriptor} with the specified inheritedByDefault
536      */
537     @Nonnull
538     public MojoDescriptor withInheritedByDefault(boolean inheritedByDefault) {
539         return newBuilder(this, true).inheritedByDefault(inheritedByDefault).build();
540     }
541     /**
542      * Creates a new {@code MojoDescriptor} instance using the specified since.
543      *
544      * @param since the new {@code String} to use
545      * @return a {@code MojoDescriptor} with the specified since
546      */
547     @Nonnull
548     public MojoDescriptor withSince(String since) {
549         return newBuilder(this, true).since(since).build();
550     }
551     /**
552      * Creates a new {@code MojoDescriptor} instance using the specified deprecated.
553      *
554      * @param deprecated the new {@code String} to use
555      * @return a {@code MojoDescriptor} with the specified deprecated
556      */
557     @Nonnull
558     public MojoDescriptor withDeprecated(String deprecated) {
559         return newBuilder(this, true).deprecated(deprecated).build();
560     }
561     /**
562      * Creates a new {@code MojoDescriptor} instance using the specified configurator.
563      *
564      * @param configurator the new {@code String} to use
565      * @return a {@code MojoDescriptor} with the specified configurator
566      */
567     @Nonnull
568     public MojoDescriptor withConfigurator(String configurator) {
569         return newBuilder(this, true).configurator(configurator).build();
570     }
571     /**
572      * Creates a new {@code MojoDescriptor} instance using the specified parameters.
573      *
574      * @param parameters the new {@code Collection<Parameter>} to use
575      * @return a {@code MojoDescriptor} with the specified parameters
576      */
577     @Nonnull
578     public MojoDescriptor withParameters(Collection<Parameter> parameters) {
579         return newBuilder(this, true).parameters(parameters).build();
580     }
581     /**
582      * Creates a new {@code MojoDescriptor} instance using the specified resolutions.
583      *
584      * @param resolutions the new {@code Collection<Resolution>} to use
585      * @return a {@code MojoDescriptor} with the specified resolutions
586      */
587     @Nonnull
588     public MojoDescriptor withResolutions(Collection<Resolution> resolutions) {
589         return newBuilder(this, true).resolutions(resolutions).build();
590     }
591     /**
592      * Creates a new {@code MojoDescriptor} instance using the specified id.
593      *
594      * @param id the new {@code String} to use
595      * @return a {@code MojoDescriptor} with the specified id
596      */
597     @Nonnull
598     public MojoDescriptor withId(String id) {
599         return newBuilder(this, true).id(id).build();
600     }
601     /**
602      * Creates a new {@code MojoDescriptor} instance using the specified fullGoalName.
603      *
604      * @param fullGoalName the new {@code String} to use
605      * @return a {@code MojoDescriptor} with the specified fullGoalName
606      */
607     @Nonnull
608     public MojoDescriptor withFullGoalName(String fullGoalName) {
609         return newBuilder(this, true).fullGoalName(fullGoalName).build();
610     }
611 
612     /**
613      * Creates a new {@code MojoDescriptor} instance.
614      * Equivalent to {@code newInstance(true)}.
615      * @see #newInstance(boolean)
616      *
617      * @return a new {@code MojoDescriptor}
618      */
619     @Nonnull
620     public static MojoDescriptor newInstance() {
621         return newInstance(true);
622     }
623 
624     /**
625      * Creates a new {@code MojoDescriptor} instance using default values or not.
626      * Equivalent to {@code newBuilder(withDefaults).build()}.
627      *
628      * @param withDefaults the boolean indicating whether default values should be used
629      * @return a new {@code MojoDescriptor}
630      */
631     @Nonnull
632     public static MojoDescriptor newInstance(boolean withDefaults) {
633         return newBuilder(withDefaults).build();
634     }
635 
636     /**
637      * Creates a new {@code MojoDescriptor} builder instance.
638      * Equivalent to {@code newBuilder(true)}.
639      * @see #newBuilder(boolean)
640      *
641      * @return a new {@code Builder}
642      */
643     @Nonnull
644     public static Builder newBuilder() {
645         return newBuilder(true);
646     }
647 
648     /**
649      * Creates a new {@code MojoDescriptor} builder instance using default values or not.
650      *
651      * @param withDefaults the boolean indicating whether default values should be used
652      * @return a new {@code Builder}
653      */
654     @Nonnull
655     public static Builder newBuilder(boolean withDefaults) {
656         return new Builder(withDefaults);
657     }
658 
659     /**
660      * Creates a new {@code MojoDescriptor} builder instance using the specified object as a basis.
661      * Equivalent to {@code newBuilder(from, false)}.
662      *
663      * @param from the {@code MojoDescriptor} instance to use as a basis
664      * @return a new {@code Builder}
665      */
666     @Nonnull
667     public static Builder newBuilder(MojoDescriptor from) {
668         return newBuilder(from, false);
669     }
670 
671     /**
672      * Creates a new {@code MojoDescriptor} builder instance using the specified object as a basis.
673      *
674      * @param from the {@code MojoDescriptor} instance to use as a basis
675      * @param forceCopy the boolean indicating if a copy should be forced
676      * @return a new {@code Builder}
677      */
678     @Nonnull
679     public static Builder newBuilder(MojoDescriptor from, boolean forceCopy) {
680         return new Builder(from, forceCopy);
681     }
682 
683     /**
684      * Builder class used to create MojoDescriptor instances.
685      * @see #with()
686      * @see #newBuilder()
687      */
688     @NotThreadSafe
689     public static class Builder
690     {
691         MojoDescriptor base;
692         String goal;
693         String description;
694         String implementation;
695         String language;
696         String phase;
697         String executePhase;
698         String executeGoal;
699         String executeLifecycle;
700         String dependencyResolution;
701         String dependencyCollection;
702         Boolean directInvocationOnly;
703         Boolean projectRequired;
704         Boolean onlineRequired;
705         Boolean aggregator;
706         Boolean inheritedByDefault;
707         String since;
708         String deprecated;
709         String configurator;
710         Collection<Parameter> parameters;
711         Collection<Resolution> resolutions;
712         String id;
713         String fullGoalName;
714 
715         protected Builder(boolean withDefaults) {
716             if (withDefaults) {
717                 this.language = "java";
718                 this.dependencyResolution = "runtime";
719                 this.directInvocationOnly = false;
720                 this.projectRequired = true;
721                 this.onlineRequired = false;
722                 this.aggregator = false;
723                 this.inheritedByDefault = true;
724             }
725         }
726 
727         protected Builder(MojoDescriptor base, boolean forceCopy) {
728             if (forceCopy) {
729                 this.goal = base.goal;
730                 this.description = base.description;
731                 this.implementation = base.implementation;
732                 this.language = base.language;
733                 this.phase = base.phase;
734                 this.executePhase = base.executePhase;
735                 this.executeGoal = base.executeGoal;
736                 this.executeLifecycle = base.executeLifecycle;
737                 this.dependencyResolution = base.dependencyResolution;
738                 this.dependencyCollection = base.dependencyCollection;
739                 this.directInvocationOnly = base.directInvocationOnly;
740                 this.projectRequired = base.projectRequired;
741                 this.onlineRequired = base.onlineRequired;
742                 this.aggregator = base.aggregator;
743                 this.inheritedByDefault = base.inheritedByDefault;
744                 this.since = base.since;
745                 this.deprecated = base.deprecated;
746                 this.configurator = base.configurator;
747                 this.parameters = base.parameters;
748                 this.resolutions = base.resolutions;
749                 this.id = base.id;
750                 this.fullGoalName = base.fullGoalName;
751             } else {
752                 this.base = base;
753             }
754         }
755 
756         @Nonnull
757         public Builder goal(String goal) {
758             this.goal = goal;
759             return this;
760         }
761 
762         @Nonnull
763         public Builder description(String description) {
764             this.description = description;
765             return this;
766         }
767 
768         @Nonnull
769         public Builder implementation(String implementation) {
770             this.implementation = implementation;
771             return this;
772         }
773 
774         @Nonnull
775         public Builder language(String language) {
776             this.language = language;
777             return this;
778         }
779 
780         @Nonnull
781         public Builder phase(String phase) {
782             this.phase = phase;
783             return this;
784         }
785 
786         @Nonnull
787         public Builder executePhase(String executePhase) {
788             this.executePhase = executePhase;
789             return this;
790         }
791 
792         @Nonnull
793         public Builder executeGoal(String executeGoal) {
794             this.executeGoal = executeGoal;
795             return this;
796         }
797 
798         @Nonnull
799         public Builder executeLifecycle(String executeLifecycle) {
800             this.executeLifecycle = executeLifecycle;
801             return this;
802         }
803 
804         @Nonnull
805         public Builder dependencyResolution(String dependencyResolution) {
806             this.dependencyResolution = dependencyResolution;
807             return this;
808         }
809 
810         @Nonnull
811         public Builder dependencyCollection(String dependencyCollection) {
812             this.dependencyCollection = dependencyCollection;
813             return this;
814         }
815 
816         @Nonnull
817         public Builder directInvocationOnly(boolean directInvocationOnly) {
818             this.directInvocationOnly = directInvocationOnly;
819             return this;
820         }
821 
822         @Nonnull
823         public Builder projectRequired(boolean projectRequired) {
824             this.projectRequired = projectRequired;
825             return this;
826         }
827 
828         @Nonnull
829         public Builder onlineRequired(boolean onlineRequired) {
830             this.onlineRequired = onlineRequired;
831             return this;
832         }
833 
834         @Nonnull
835         public Builder aggregator(boolean aggregator) {
836             this.aggregator = aggregator;
837             return this;
838         }
839 
840         @Nonnull
841         public Builder inheritedByDefault(boolean inheritedByDefault) {
842             this.inheritedByDefault = inheritedByDefault;
843             return this;
844         }
845 
846         @Nonnull
847         public Builder since(String since) {
848             this.since = since;
849             return this;
850         }
851 
852         @Nonnull
853         public Builder deprecated(String deprecated) {
854             this.deprecated = deprecated;
855             return this;
856         }
857 
858         @Nonnull
859         public Builder configurator(String configurator) {
860             this.configurator = configurator;
861             return this;
862         }
863 
864         @Nonnull
865         public Builder parameters(Collection<Parameter> parameters) {
866             this.parameters = parameters;
867             return this;
868         }
869 
870         @Nonnull
871         public Builder resolutions(Collection<Resolution> resolutions) {
872             this.resolutions = resolutions;
873             return this;
874         }
875 
876         @Nonnull
877         public Builder id(String id) {
878             this.id = id;
879             return this;
880         }
881 
882         @Nonnull
883         public Builder fullGoalName(String fullGoalName) {
884             this.fullGoalName = fullGoalName;
885             return this;
886         }
887 
888 
889         @Nonnull
890         public MojoDescriptor build() {
891             // this method should not contain any logic other than creating (or reusing) an object in order to ease subclassing
892             if (base != null
893                     && (goal == null || goal == base.goal)
894                     && (description == null || description == base.description)
895                     && (implementation == null || implementation == base.implementation)
896                     && (language == null || language == base.language)
897                     && (phase == null || phase == base.phase)
898                     && (executePhase == null || executePhase == base.executePhase)
899                     && (executeGoal == null || executeGoal == base.executeGoal)
900                     && (executeLifecycle == null || executeLifecycle == base.executeLifecycle)
901                     && (dependencyResolution == null || dependencyResolution == base.dependencyResolution)
902                     && (dependencyCollection == null || dependencyCollection == base.dependencyCollection)
903                     && (directInvocationOnly == null || directInvocationOnly == base.directInvocationOnly)
904                     && (projectRequired == null || projectRequired == base.projectRequired)
905                     && (onlineRequired == null || onlineRequired == base.onlineRequired)
906                     && (aggregator == null || aggregator == base.aggregator)
907                     && (inheritedByDefault == null || inheritedByDefault == base.inheritedByDefault)
908                     && (since == null || since == base.since)
909                     && (deprecated == null || deprecated == base.deprecated)
910                     && (configurator == null || configurator == base.configurator)
911                     && (parameters == null || parameters == base.parameters)
912                     && (resolutions == null || resolutions == base.resolutions)
913                     && (id == null || id == base.id)
914                     && (fullGoalName == null || fullGoalName == base.fullGoalName)
915             ) {
916                 return base;
917             }
918             return new MojoDescriptor(this);
919         }
920 
921     }
922 
923 }