View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.doxia.tools.stubs;
20  
21  import java.io.File;
22  import java.io.IOException;
23  import java.io.Writer;
24  import java.util.ArrayList;
25  import java.util.Collections;
26  import java.util.List;
27  import java.util.Map;
28  import java.util.Properties;
29  import java.util.Set;
30  
31  import org.apache.maven.artifact.Artifact;
32  import org.apache.maven.artifact.DependencyResolutionRequiredException;
33  import org.apache.maven.artifact.factory.ArtifactFactory;
34  import org.apache.maven.artifact.repository.ArtifactRepository;
35  import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
36  import org.apache.maven.model.Build;
37  import org.apache.maven.model.CiManagement;
38  import org.apache.maven.model.Contributor;
39  import org.apache.maven.model.Dependency;
40  import org.apache.maven.model.DependencyManagement;
41  import org.apache.maven.model.Developer;
42  import org.apache.maven.model.DistributionManagement;
43  import org.apache.maven.model.Extension;
44  import org.apache.maven.model.IssueManagement;
45  import org.apache.maven.model.License;
46  import org.apache.maven.model.MailingList;
47  import org.apache.maven.model.Model;
48  import org.apache.maven.model.Organization;
49  import org.apache.maven.model.Plugin;
50  import org.apache.maven.model.PluginManagement;
51  import org.apache.maven.model.Prerequisites;
52  import org.apache.maven.model.Profile;
53  import org.apache.maven.model.ReportPlugin;
54  import org.apache.maven.model.Reporting;
55  import org.apache.maven.model.Repository;
56  import org.apache.maven.model.Resource;
57  import org.apache.maven.model.Scm;
58  import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
59  import org.apache.maven.project.MavenProject;
60  import org.codehaus.plexus.testing.PlexusExtension;
61  import org.codehaus.plexus.util.ReaderFactory;
62  import org.codehaus.plexus.util.xml.Xpp3Dom;
63  import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
64  
65  /**
66   * Very simple stub of <code>MavenProject</code> object, going to take a lot of work to make it
67   * useful as a stub though.
68   *
69   * @author jesse
70   * @version $Id$
71   */
72  public class MavenProjectStub extends MavenProject {
73      private String groupId;
74  
75      private String artifactId;
76  
77      private String name;
78  
79      private Model model;
80  
81      private MavenProject parent;
82  
83      private File file;
84  
85      private List<MavenProject> collectedProjects;
86  
87      private List<Artifact> attachedArtifacts;
88  
89      private List<String> compileSourceRoots;
90  
91      private List<String> testCompileSourceRoots;
92  
93      private List<String> scriptSourceRoots;
94  
95      private List<ArtifactRepository> pluginArtifactRepositories;
96  
97      private ArtifactRepository releaseArtifactRepository;
98  
99      private ArtifactRepository snapshotArtifactRepository;
100 
101     private List<Profile> activeProfiles;
102 
103     private Set<Artifact> dependencyArtifacts;
104 
105     private Artifact artifact;
106 
107     private Map<String, Artifact> artifactMap;
108 
109     private Model originalModel;
110 
111     private Map<String, Artifact> pluginArtifactMap;
112 
113     private Map<String, Artifact> reportArtifactMap;
114 
115     private Map<String, Artifact> extensionArtifactMap;
116 
117     private Map<String, MavenProject> projectReferences;
118 
119     private Build buildOverlay;
120 
121     private boolean executionRoot;
122 
123     private List<Artifact> compileArtifacts;
124 
125     private List<Dependency> compileDependencies;
126 
127     private List<Dependency> systemDependencies;
128 
129     private List<String> testClasspathElements;
130 
131     private List<Dependency> testDependencies;
132 
133     private List<String> systemClasspathElements;
134 
135     private List<Artifact> systemArtifacts;
136 
137     private List<Artifact> testArtifacts;
138 
139     private List<Artifact> runtimeArtifacts;
140 
141     private List<Dependency> runtimeDependencies;
142 
143     private List<String> runtimeClasspathElements;
144 
145     private String modelVersion;
146 
147     private String packaging;
148 
149     private String inceptionYear;
150 
151     private String url;
152 
153     private String description;
154 
155     private String version;
156 
157     private String defaultGoal;
158 
159     private List<License> licenses;
160 
161     private Build build;
162 
163     /**
164      * Default constructor
165      */
166     public MavenProjectStub() {
167         this(new Model());
168     }
169 
170     /**
171      * @param model the given model
172      */
173     public MavenProjectStub(Model model) {
174         super((Model) null);
175         this.model = model;
176     }
177 
178     /**
179      * Loads the model for this stub from the specified POM. For convenience, any checked exception caused by I/O or
180      * parser errors will be wrapped into an unchecked exception.
181      *
182      * @param pomFile The path to the POM file to load, must not be <code>null</code>. If this path is relative, it
183      *            is resolved against the return value of {@link #getBasedir()}.
184      */
185     protected void readModel(File pomFile) {
186         if (!pomFile.isAbsolute()) {
187             pomFile = new File(getBasedir(), pomFile.getPath());
188         }
189         try {
190             setModel(new MavenXpp3Reader().read(ReaderFactory.newXmlReader(pomFile)));
191         } catch (IOException e) {
192             throw new RuntimeException("Failed to read POM file: " + pomFile, e);
193         } catch (XmlPullParserException e) {
194             throw new RuntimeException("Failed to parse POM file: " + pomFile, e);
195         }
196     }
197 
198     /**
199      * No project model is associated
200      *
201      * @param project the given project
202      */
203     public MavenProjectStub(MavenProject project) {
204         super((Model) null);
205     }
206 
207     /**
208      * @param mavenProject
209      * @return an empty String
210      * @throws IOException if any
211      */
212     public String getModulePathAdjustment(MavenProject mavenProject) throws IOException {
213         return "";
214     }
215 
216     /** {@inheritDoc} */
217     public Artifact getArtifact() {
218         return artifact;
219     }
220 
221     /** {@inheritDoc} */
222     public void setArtifact(Artifact artifact) {
223         this.artifact = artifact;
224     }
225 
226     /** {@inheritDoc} */
227     public Model getModel() {
228         return model;
229     }
230 
231     /** {@inheritDoc} */
232     public MavenProject getParent() {
233         return parent;
234     }
235 
236     /** {@inheritDoc} */
237     public void setParent(MavenProject mavenProject) {
238         this.parent = mavenProject;
239     }
240 
241     /**
242      * By default, do nothing.
243      *
244      * @see MavenProject#setRemoteArtifactRepositories(List)
245      */
246     public void setRemoteArtifactRepositories(List<ArtifactRepository> list) {
247         // nop
248     }
249 
250     /**
251      * By default, return <code>Collections.EMPTY_LIST</code>.
252      *
253      * @see MavenProject#getRemoteArtifactRepositories()
254      */
255     public List<ArtifactRepository> getRemoteArtifactRepositories() {
256         return Collections.<ArtifactRepository>emptyList();
257     }
258 
259     /** {@inheritDoc} */
260     public boolean hasParent() {
261         if (parent != null) {
262             return true;
263         }
264 
265         return false;
266     }
267 
268     /** {@inheritDoc} */
269     public File getFile() {
270         return file;
271     }
272 
273     /** {@inheritDoc} */
274     public void setFile(File file) {
275         this.file = file;
276     }
277 
278     /** {@inheritDoc} */
279     public File getBasedir() {
280         return new File(PlexusExtension.getBasedir());
281     }
282 
283     /**
284      * By default, do nothing.
285      *
286      * @see MavenProject#setDependencies(List)
287      */
288     public void setDependencies(List<Dependency> list) {
289         // nop
290     }
291 
292     /**
293      * By default, return <code>Collections.EMPTY_LIST</code>.
294      *
295      * @see MavenProject#getDependencies()
296      */
297     public List<Dependency> getDependencies() {
298         return Collections.<Dependency>emptyList();
299     }
300 
301     /**
302      * By default, return <code>null</code>.
303      *
304      * @see MavenProject#getDependencyManagement()
305      */
306     public DependencyManagement getDependencyManagement() {
307         return null;
308     }
309 
310     /** {@inheritDoc} */
311     public void addCompileSourceRoot(String string) {
312         if (compileSourceRoots == null) {
313             compileSourceRoots = new ArrayList<>(Collections.singletonList(string));
314         } else {
315             compileSourceRoots.add(string);
316         }
317     }
318 
319     /** {@inheritDoc} */
320     public void addScriptSourceRoot(String string) {
321         if (scriptSourceRoots == null) {
322             scriptSourceRoots = new ArrayList<>(Collections.singletonList(string));
323         } else {
324             scriptSourceRoots.add(string);
325         }
326     }
327 
328     /** {@inheritDoc} */
329     public void addTestCompileSourceRoot(String string) {
330         if (testCompileSourceRoots == null) {
331             testCompileSourceRoots = new ArrayList<>(Collections.singletonList(string));
332         } else {
333             testCompileSourceRoots.add(string);
334         }
335     }
336 
337     /** {@inheritDoc} */
338     public List<String> getCompileSourceRoots() {
339         return compileSourceRoots;
340     }
341 
342     /** {@inheritDoc} */
343     public List<String> getScriptSourceRoots() {
344         return scriptSourceRoots;
345     }
346 
347     /** {@inheritDoc} */
348     public List<String> getTestCompileSourceRoots() {
349         return testCompileSourceRoots;
350     }
351 
352     /** {@inheritDoc} */
353     public List<String> getCompileClasspathElements() throws DependencyResolutionRequiredException {
354         return compileSourceRoots;
355     }
356 
357     /**
358      * @param compileArtifacts
359      */
360     public void setCompileArtifacts(List<Artifact> compileArtifacts) {
361         this.compileArtifacts = compileArtifacts;
362     }
363 
364     /** {@inheritDoc} */
365     public List<Artifact> getCompileArtifacts() {
366         return compileArtifacts;
367     }
368 
369     /** {@inheritDoc} */
370     public List<Dependency> getCompileDependencies() {
371         return compileDependencies;
372     }
373 
374     /** {@inheritDoc} */
375     public List<String> getTestClasspathElements() throws DependencyResolutionRequiredException {
376         return testClasspathElements;
377     }
378 
379     /** {@inheritDoc} */
380     public List<Artifact> getTestArtifacts() {
381         return testArtifacts;
382     }
383 
384     /** {@inheritDoc} */
385     public List<Dependency> getTestDependencies() {
386         return testDependencies;
387     }
388 
389     /** {@inheritDoc} */
390     public List<String> getRuntimeClasspathElements() throws DependencyResolutionRequiredException {
391         return runtimeClasspathElements;
392     }
393 
394     /** {@inheritDoc} */
395     public List<Artifact> getRuntimeArtifacts() {
396         return runtimeArtifacts;
397     }
398 
399     /** {@inheritDoc} */
400     public List<Dependency> getRuntimeDependencies() {
401         return runtimeDependencies;
402     }
403 
404     /** {@inheritDoc} */
405     public List<String> getSystemClasspathElements() throws DependencyResolutionRequiredException {
406         return systemClasspathElements;
407     }
408 
409     /** {@inheritDoc} */
410     public List<Artifact> getSystemArtifacts() {
411         return systemArtifacts;
412     }
413 
414     /**
415      * @param runtimeClasspathElements
416      */
417     public void setRuntimeClasspathElements(List<String> runtimeClasspathElements) {
418         this.runtimeClasspathElements = runtimeClasspathElements;
419     }
420 
421     /**
422      * @param attachedArtifacts
423      */
424     public void setAttachedArtifacts(List<Artifact> attachedArtifacts) {
425         this.attachedArtifacts = attachedArtifacts;
426     }
427 
428     /**
429      * @param compileSourceRoots
430      */
431     public void setCompileSourceRoots(List<String> compileSourceRoots) {
432         this.compileSourceRoots = compileSourceRoots;
433     }
434 
435     /**
436      * @param testCompileSourceRoots
437      */
438     public void setTestCompileSourceRoots(List<String> testCompileSourceRoots) {
439         this.testCompileSourceRoots = testCompileSourceRoots;
440     }
441 
442     /**
443      * @param scriptSourceRoots
444      */
445     public void setScriptSourceRoots(List<String> scriptSourceRoots) {
446         this.scriptSourceRoots = scriptSourceRoots;
447     }
448 
449     /**
450      * @param artifactMap
451      */
452     public void setArtifactMap(Map<String, Artifact> artifactMap) {
453         this.artifactMap = artifactMap;
454     }
455 
456     /**
457      * @param pluginArtifactMap
458      */
459     public void setPluginArtifactMap(Map<String, Artifact> pluginArtifactMap) {
460         this.pluginArtifactMap = pluginArtifactMap;
461     }
462 
463     /**
464      * @param reportArtifactMap
465      */
466     public void setReportArtifactMap(Map<String, Artifact> reportArtifactMap) {
467         this.reportArtifactMap = reportArtifactMap;
468     }
469 
470     /**
471      * @param extensionArtifactMap
472      */
473     public void setExtensionArtifactMap(Map<String, Artifact> extensionArtifactMap) {
474         this.extensionArtifactMap = extensionArtifactMap;
475     }
476 
477     /**
478      * @param projectReferences
479      */
480     public void setProjectReferences(Map<String, MavenProject> projectReferences) {
481         this.projectReferences = projectReferences;
482     }
483 
484     /**
485      * @param buildOverlay
486      */
487     public void setBuildOverlay(Build buildOverlay) {
488         this.buildOverlay = buildOverlay;
489     }
490 
491     /**
492      * @param compileDependencies
493      */
494     public void setCompileDependencies(List<Dependency> compileDependencies) {
495         this.compileDependencies = compileDependencies;
496     }
497 
498     /**
499      * @param systemDependencies
500      */
501     public void setSystemDependencies(List<Dependency> systemDependencies) {
502         this.systemDependencies = systemDependencies;
503     }
504 
505     /**
506      * @param testClasspathElements
507      */
508     public void setTestClasspathElements(List<String> testClasspathElements) {
509         this.testClasspathElements = testClasspathElements;
510     }
511 
512     /**
513      * @param testDependencies
514      */
515     public void setTestDependencies(List<Dependency> testDependencies) {
516         this.testDependencies = testDependencies;
517     }
518 
519     /**
520      * @param systemClasspathElements
521      */
522     public void setSystemClasspathElements(List<String> systemClasspathElements) {
523         this.systemClasspathElements = systemClasspathElements;
524     }
525 
526     /**
527      * @param systemArtifacts
528      */
529     public void setSystemArtifacts(List<Artifact> systemArtifacts) {
530         this.systemArtifacts = systemArtifacts;
531     }
532 
533     /**
534      * @param testArtifacts
535      */
536     public void setTestArtifacts(List<Artifact> testArtifacts) {
537         this.testArtifacts = testArtifacts;
538     }
539 
540     /**
541      * @param runtimeArtifacts
542      */
543     public void setRuntimeArtifacts(List<Artifact> runtimeArtifacts) {
544         this.runtimeArtifacts = runtimeArtifacts;
545     }
546 
547     /**
548      * @param runtimeDependencies
549      */
550     public void setRuntimeDependencies(List<Dependency> runtimeDependencies) {
551         this.runtimeDependencies = runtimeDependencies;
552     }
553 
554     /**
555      * @param model
556      */
557     public void setModel(Model model) {
558         this.model = model;
559     }
560 
561     /** {@inheritDoc} */
562     public List<Dependency> getSystemDependencies() {
563         return systemDependencies;
564     }
565 
566     /** {@inheritDoc} */
567     public void setModelVersion(String string) {
568         this.modelVersion = string;
569     }
570 
571     /** {@inheritDoc} */
572     public String getModelVersion() {
573         return modelVersion;
574     }
575 
576     /**
577      * By default, return an empty String.
578      *
579      * @see MavenProject#getId()
580      */
581     public String getId() {
582         return "";
583     }
584 
585     /** {@inheritDoc} */
586     public void setGroupId(String string) {
587         this.groupId = string;
588     }
589 
590     /** {@inheritDoc} */
591     public String getGroupId() {
592         return groupId;
593     }
594 
595     /** {@inheritDoc} */
596     public void setArtifactId(String string) {
597         this.artifactId = string;
598     }
599 
600     /** {@inheritDoc} */
601     public String getArtifactId() {
602         return artifactId;
603     }
604 
605     /** {@inheritDoc} */
606     public void setName(String string) {
607         this.name = string;
608     }
609 
610     /** {@inheritDoc} */
611     public String getName() {
612         return name;
613     }
614 
615     /** {@inheritDoc} */
616     public void setVersion(String string) {
617         this.version = string;
618     }
619 
620     /** {@inheritDoc} */
621     public String getVersion() {
622         return version;
623     }
624 
625     /** {@inheritDoc} */
626     public String getPackaging() {
627         return packaging;
628     }
629 
630     /** {@inheritDoc} */
631     public void setPackaging(String string) {
632         this.packaging = string;
633     }
634 
635     /** {@inheritDoc} */
636     public void setInceptionYear(String string) {
637         this.inceptionYear = string;
638     }
639 
640     /** {@inheritDoc} */
641     public String getInceptionYear() {
642         return inceptionYear;
643     }
644 
645     /** {@inheritDoc} */
646     public void setUrl(String string) {
647         this.url = string;
648     }
649 
650     /** {@inheritDoc} */
651     public String getUrl() {
652         return url;
653     }
654 
655     /**
656      * By default, return <code>null</code>.
657      *
658      * @see MavenProject#getPrerequisites()
659      */
660     public Prerequisites getPrerequisites() {
661         return null;
662     }
663 
664     /**
665      * By default, do nothing.
666      *
667      * @see MavenProject#setIssueManagement(IssueManagement)
668      */
669     public void setIssueManagement(IssueManagement issueManagement) {
670         // nop
671     }
672 
673     /**
674      * By default, return <code>null</code>.
675      *
676      * @see MavenProject#getCiManagement()
677      */
678     public CiManagement getCiManagement() {
679         return null;
680     }
681 
682     /**
683      * By default, do nothing.
684      *
685      * @see MavenProject#setCiManagement(CiManagement)
686      */
687     public void setCiManagement(CiManagement ciManagement) {
688         // nop
689     }
690 
691     /**
692      * By default, return <code>null</code>.
693      *
694      * @see MavenProject#getIssueManagement()
695      */
696     public IssueManagement getIssueManagement() {
697         return null;
698     }
699 
700     /**
701      * By default, do nothing.
702      *
703      * @see MavenProject#setDistributionManagement(DistributionManagement)
704      */
705     public void setDistributionManagement(DistributionManagement distributionManagement) {
706         // nop
707     }
708 
709     /**
710      * By default, return <code>null</code>.
711      *
712      * @see MavenProject#getDistributionManagement()
713      */
714     public DistributionManagement getDistributionManagement() {
715         return null;
716     }
717 
718     /** {@inheritDoc} */
719     public void setDescription(String string) {
720         this.description = string;
721     }
722 
723     /** {@inheritDoc} */
724     public String getDescription() {
725         return description;
726     }
727 
728     /**
729      * By default, do nothing.
730      *
731      * @see MavenProject#setOrganization(Organization)
732      */
733     public void setOrganization(Organization organization) {
734         // nop
735     }
736 
737     /**
738      * By default, return <code>null</code>.
739      *
740      * @see MavenProject#getOrganization()
741      */
742     public Organization getOrganization() {
743         return null;
744     }
745 
746     /**
747      * By default, do nothing.
748      *
749      * @see MavenProject#setScm(Scm)
750      */
751     public void setScm(Scm scm) {
752         // nop
753     }
754 
755     /**
756      * By default, return <code>null</code>.
757      *
758      * @see MavenProject#getScm()
759      */
760     public Scm getScm() {
761         return null;
762     }
763 
764     /**
765      * By default, do nothing.
766      *
767      * @see MavenProject#setMailingLists(List)
768      */
769     public void setMailingLists(List<MailingList> list) {
770         // nop
771     }
772 
773     /**
774      * By default, return <code>Collections.EMPTY_LIST</code>.
775      *
776      * @see MavenProject#getMailingLists()
777      */
778     public List<MailingList> getMailingLists() {
779         return Collections.<MailingList>emptyList();
780     }
781 
782     /**
783      * By default, do nothing.
784      *
785      * @see MavenProject#addMailingList(MailingList)
786      */
787     public void addMailingList(MailingList mailingList) {
788         // nop
789     }
790 
791     /**
792      * By default, do nothing.
793      *
794      * @see MavenProject#setDevelopers(List)
795      */
796     public void setDevelopers(List<Developer> list) {
797         // nop
798     }
799 
800     /**
801      * By default, return <code>Collections.EMPTY_LIST</code>.
802      *
803      * @see MavenProject#getDevelopers()
804      */
805     public List<Developer> getDevelopers() {
806         return Collections.<Developer>emptyList();
807     }
808 
809     /**
810      * By default, do nothing.
811      *
812      * @see MavenProject#addDeveloper(Developer)
813      */
814     public void addDeveloper(Developer developer) {
815         // nop
816     }
817 
818     /**
819      * By default, do nothing.
820      *
821      * @see MavenProject#setContributors(List)
822      */
823     public void setContributors(List<Contributor> list) {
824         // nop
825     }
826 
827     /**
828      * By default, return <code>Collections.EMPTY_LIST</code>.
829      *
830      * @see MavenProject#getContributors()
831      */
832     public List<Contributor> getContributors() {
833         return Collections.<Contributor>emptyList();
834     }
835 
836     /**
837      * By default, do nothing.
838      *
839      * @see MavenProject#addContributor(Contributor)
840      */
841     public void addContributor(Contributor contributor) {
842         // nop
843     }
844 
845     /** {@inheritDoc} */
846     public void setBuild(Build build) {
847         this.build = build;
848     }
849 
850     /** {@inheritDoc} */
851     public Build getBuild() {
852         return build;
853     }
854 
855     /**
856      * By default, return <code>Collections.EMPTY_LIST</code>.
857      *
858      * @see MavenProject#getResources()
859      */
860     public List<Resource> getResources() {
861         return Collections.<Resource>emptyList();
862     }
863 
864     /**
865      * By default, return <code>Collections.EMPTY_LIST</code>.
866      *
867      * @see MavenProject#getTestResources()
868      */
869     public List<Resource> getTestResources() {
870         return Collections.<Resource>emptyList();
871     }
872 
873     /**
874      * By default, do nothing.
875      *
876      * @see MavenProject#addResource(Resource)
877      */
878     public void addResource(Resource resource) {
879         // nop
880     }
881 
882     /**
883      * By default, do nothing.
884      *
885      * @see MavenProject#addTestResource(Resource)
886      */
887     public void addTestResource(Resource resource) {
888         // nop
889     }
890 
891     /**
892      * By default, do nothing.
893      *
894      * @see MavenProject#setReporting(Reporting)
895      */
896     public void setReporting(Reporting reporting) {
897         // nop
898     }
899 
900     /**
901      * By default, return <code>null</code>.
902      *
903      * @see MavenProject#getReporting()
904      */
905     public Reporting getReporting() {
906         return null;
907     }
908 
909     /** {@inheritDoc} */
910     public void setLicenses(List<License> licenses) {
911         this.licenses = licenses;
912     }
913 
914     /** {@inheritDoc} */
915     public List<License> getLicenses() {
916         return licenses;
917     }
918 
919     /**
920      * By default, do nothing.
921      *
922      * @see MavenProject#addLicense(License)
923      */
924     public void addLicense(License license) {
925         // nop
926     }
927 
928     /**
929      * By default, do nothing.
930      *
931      * @see MavenProject#setArtifacts(Set)
932      */
933     public void setArtifacts(Set<Artifact> set) {
934         // nop
935     }
936 
937     /**
938      * By default, return <code>Collections.EMPTY_SET</code>.
939      *
940      * @see MavenProject#getArtifacts()
941      */
942     public Set<Artifact> getArtifacts() {
943         return Collections.<Artifact>emptySet();
944     }
945 
946     /**
947      * By default, return <code>Collections.EMPTY_MAP</code>.
948      *
949      * @see MavenProject#getArtifactMap()
950      */
951     public Map<String, Artifact> getArtifactMap() {
952         return Collections.<String, Artifact>emptyMap();
953     }
954 
955     /**
956      * By default, do nothing.
957      *
958      * @see MavenProject#setPluginArtifacts(Set)
959      */
960     public void setPluginArtifacts(Set<Artifact> set) {
961         // nop
962     }
963 
964     /**
965      * By default, return <code>Collections.EMPTY_SET</code>.
966      *
967      * @see MavenProject#getPluginArtifacts()
968      */
969     public Set<Artifact> getPluginArtifacts() {
970         return Collections.<Artifact>emptySet();
971     }
972 
973     /**
974      * By default, return <code>Collections.EMPTY_MAP</code>.
975      *
976      * @see MavenProject#getPluginArtifactMap()
977      */
978     public Map<String, Artifact> getPluginArtifactMap() {
979         return Collections.<String, Artifact>emptyMap();
980     }
981 
982     /**
983      * By default, do nothing.
984      *
985      * @see MavenProject#setReportArtifacts(Set)
986      */
987     public void setReportArtifacts(Set<Artifact> set) {
988         // nop
989     }
990 
991     /**
992      * By default, return <code>Collections.EMPTY_SET</code>.
993      *
994      * @see MavenProject#getReportArtifacts()
995      */
996     public Set<Artifact> getReportArtifacts() {
997         return Collections.<Artifact>emptySet();
998     }
999 
1000     /**
1001      * By default, return <code>Collections.EMPTY_MAP</code>.
1002      *
1003      * @see MavenProject#getReportArtifactMap()
1004      */
1005     public Map<String, Artifact> getReportArtifactMap() {
1006         return Collections.<String, Artifact>emptyMap();
1007     }
1008 
1009     /**
1010      * By default, do nothing.
1011      *
1012      * @see MavenProject#setExtensionArtifacts(Set)
1013      */
1014     public void setExtensionArtifacts(Set<Artifact> set) {
1015         // nop
1016     }
1017 
1018     /**
1019      * By default, return <code>Collections.EMPTY_SET</code>.
1020      *
1021      * @see MavenProject#getExtensionArtifacts()
1022      */
1023     public Set<Artifact> getExtensionArtifacts() {
1024         return Collections.<Artifact>emptySet();
1025     }
1026 
1027     /**
1028      * By default, return <code>Collections.EMPTY_MAP</code>.
1029      *
1030      * @see MavenProject#getExtensionArtifactMap()
1031      */
1032     public Map<String, Artifact> getExtensionArtifactMap() {
1033         return Collections.<String, Artifact>emptyMap();
1034     }
1035 
1036     /**
1037      * By default, do nothing.
1038      *
1039      * @see MavenProject#setParentArtifact(Artifact)
1040      */
1041     public void setParentArtifact(Artifact artifact) {
1042         // nop
1043     }
1044 
1045     /**
1046      * By default, return <code>null</code>.
1047      *
1048      * @see MavenProject#getParentArtifact()
1049      */
1050     public Artifact getParentArtifact() {
1051         return null;
1052     }
1053 
1054     /**
1055      * By default, return <code>Collections.EMPTY_LIST</code>.
1056      *
1057      * @see MavenProject#getRepositories()
1058      */
1059     public List<Repository> getRepositories() {
1060         return Collections.<Repository>emptyList();
1061     }
1062 
1063     /**
1064      * By default, return <code>Collections.EMPTY_LIST</code>.
1065      *
1066      * @see MavenProject#getReportPlugins()
1067      */
1068     public List<ReportPlugin> getReportPlugins() {
1069         return Collections.<ReportPlugin>emptyList();
1070     }
1071 
1072     /**
1073      * By default, return <code>Collections.EMPTY_LIST</code>.
1074      *
1075      * @see MavenProject#getBuildPlugins()
1076      */
1077     public List<Plugin> getBuildPlugins() {
1078         return Collections.<Plugin>emptyList();
1079     }
1080 
1081     /**
1082      * By default, return <code>Collections.EMPTY_LIST</code>.
1083      *
1084      * @see MavenProject#getModules()
1085      */
1086     public List<String> getModules() {
1087         return Collections.<String>emptyList();
1088     }
1089 
1090     /**
1091      * By default, return <code>null</code>.
1092      *
1093      * @see MavenProject#getPluginManagement()
1094      */
1095     public PluginManagement getPluginManagement() {
1096         return null;
1097     }
1098 
1099     /**
1100      * By default, do nothing.
1101      *
1102      * @see MavenProject#addPlugin(Plugin)
1103      */
1104     public void addPlugin(Plugin plugin) {
1105         // nop
1106     }
1107 
1108     /**
1109      * By default, do nothing.
1110      *
1111      * @param plugin
1112      */
1113     public void injectPluginManagementInfo(Plugin plugin) {
1114         // nop
1115     }
1116 
1117     /** {@inheritDoc} */
1118     public List<MavenProject> getCollectedProjects() {
1119         return collectedProjects;
1120     }
1121 
1122     /** {@inheritDoc} */
1123     public void setCollectedProjects(List<MavenProject> list) {
1124         this.collectedProjects = list;
1125     }
1126 
1127     /** {@inheritDoc} */
1128     public void setPluginArtifactRepositories(List<ArtifactRepository> list) {
1129         this.pluginArtifactRepositories = list;
1130     }
1131 
1132     /** {@inheritDoc} */
1133     public List<ArtifactRepository> getPluginArtifactRepositories() {
1134         return pluginArtifactRepositories;
1135     }
1136 
1137     /**
1138      * By default, return <code>null</code>.
1139      *
1140      * @see MavenProject#getDistributionManagementArtifactRepository()
1141      */
1142     public ArtifactRepository getDistributionManagementArtifactRepository() {
1143         return null;
1144     }
1145 
1146     /**
1147      * By default, return <code>Collections.EMPTY_LIST</code>.
1148      *
1149      * @see MavenProject#getPluginRepositories()
1150      */
1151     public List<Repository> getPluginRepositories() {
1152         return Collections.<Repository>emptyList();
1153     }
1154 
1155     /** {@inheritDoc} */
1156     public void setActiveProfiles(List<Profile> list) {
1157         activeProfiles = list;
1158     }
1159 
1160     /** {@inheritDoc} */
1161     public List<Profile> getActiveProfiles() {
1162         return activeProfiles;
1163     }
1164 
1165     /** {@inheritDoc} */
1166     public void addAttachedArtifact(Artifact artifact) {
1167         if (attachedArtifacts == null) {
1168             this.attachedArtifacts = new ArrayList<>(Collections.singletonList(artifact));
1169         } else {
1170             attachedArtifacts.add(artifact);
1171         }
1172     }
1173 
1174     /** {@inheritDoc} */
1175     public List<Artifact> getAttachedArtifacts() {
1176         return attachedArtifacts;
1177     }
1178 
1179     /**
1180      * By default, return <code>null</code>.
1181      *
1182      * @see MavenProject#getGoalConfiguration(String, String, String, String)
1183      */
1184     public Xpp3Dom getGoalConfiguration(String string, String string1, String string2, String string3) {
1185         return null;
1186     }
1187 
1188     /**
1189      * By default, return <code>null</code>.
1190      *
1191      * @see MavenProject#getReportConfiguration(String, String, String)
1192      */
1193     public Xpp3Dom getReportConfiguration(String string, String string1, String string2) {
1194         return null;
1195     }
1196 
1197     /**
1198      * By default, return <code>null</code>.
1199      *
1200      * @see MavenProject#getExecutionProject()
1201      */
1202     public MavenProject getExecutionProject() {
1203         return null;
1204     }
1205 
1206     /**
1207      * By default, do nothing.
1208      *
1209      * @see MavenProject#setExecutionProject(MavenProject)
1210      */
1211     public void setExecutionProject(MavenProject mavenProject) {
1212         // nop
1213     }
1214 
1215     /**
1216      * By default, do nothing.
1217      *
1218      * @see MavenProject#writeModel(Writer)
1219      */
1220     public void writeModel(Writer writer) throws IOException {
1221         // nop
1222     }
1223 
1224     /**
1225      * By default, do nothing.
1226      *
1227      * @see MavenProject#writeOriginalModel(Writer)
1228      */
1229     public void writeOriginalModel(Writer writer) throws IOException {
1230         // nop
1231     }
1232 
1233     /** {@inheritDoc} */
1234     public Set<Artifact> getDependencyArtifacts() {
1235         return dependencyArtifacts;
1236     }
1237 
1238     /** {@inheritDoc} */
1239     public void setDependencyArtifacts(Set<Artifact> set) {
1240         this.dependencyArtifacts = set;
1241     }
1242 
1243     /** {@inheritDoc} */
1244     public void setReleaseArtifactRepository(ArtifactRepository artifactRepository) {
1245         this.releaseArtifactRepository = artifactRepository;
1246     }
1247 
1248     /** {@inheritDoc} */
1249     public void setSnapshotArtifactRepository(ArtifactRepository artifactRepository) {
1250         this.snapshotArtifactRepository = artifactRepository;
1251     }
1252 
1253     /** {@inheritDoc} */
1254     public void setOriginalModel(Model model) {
1255         this.originalModel = model;
1256     }
1257 
1258     /** {@inheritDoc} */
1259     public Model getOriginalModel() {
1260         return originalModel;
1261     }
1262 
1263     /**
1264      * By default, return <code>Collections.EMPTY_LIST</code>.
1265      *
1266      * @see MavenProject#getBuildExtensions()
1267      */
1268     public List<Extension> getBuildExtensions() {
1269         return Collections.<Extension>emptyList();
1270     }
1271 
1272     /**
1273      * By default, return <code>Collections.EMPTY_SET</code>.
1274      *
1275      * @see MavenProject#createArtifacts(ArtifactFactory, String, ArtifactFilter)
1276      */
1277     public Set<Artifact> createArtifacts(
1278             ArtifactFactory artifactFactory, String string, ArtifactFilter artifactFilter) {
1279         return Collections.<Artifact>emptySet();
1280     }
1281 
1282     /**
1283      * By default, do nothing.
1284      *
1285      * @see MavenProject#addProjectReference(MavenProject)
1286      */
1287     public void addProjectReference(MavenProject mavenProject) {
1288         // nop
1289     }
1290 
1291     /**
1292      * By default, do nothing.
1293      *
1294      * @see MavenProject#attachArtifact(String, String, File)
1295      */
1296     public void attachArtifact(String string, String string1, File file) {
1297         // nop
1298     }
1299 
1300     /**
1301      * By default, return a new instance of <code>Properties</code>.
1302      *
1303      * @see MavenProject#getProperties()
1304      */
1305     public Properties getProperties() {
1306         return new Properties();
1307     }
1308 
1309     /**
1310      * By default, return <code>Collections.EMPTY_LIST</code>.
1311      *
1312      * @see MavenProject#getFilters()
1313      */
1314     public List<String> getFilters() {
1315         return Collections.<String>emptyList();
1316     }
1317 
1318     /**
1319      * By default, return <code>Collections.EMPTY_MAP</code>.
1320      *
1321      * @see MavenProject#getProjectReferences()
1322      */
1323     public Map<String, MavenProject> getProjectReferences() {
1324         return Collections.<String, MavenProject>emptyMap();
1325     }
1326 
1327     /** {@inheritDoc} */
1328     public boolean isExecutionRoot() {
1329         return executionRoot;
1330     }
1331 
1332     /** {@inheritDoc} */
1333     public void setExecutionRoot(boolean b) {
1334         this.executionRoot = b;
1335     }
1336 
1337     /** {@inheritDoc} */
1338     public String getDefaultGoal() {
1339         return defaultGoal;
1340     }
1341 
1342     /**
1343      * By default, return <code>null</code>.
1344      *
1345      * @see MavenProject#replaceWithActiveArtifact(Artifact)
1346      */
1347     public Artifact replaceWithActiveArtifact(Artifact artifact) {
1348         return null;
1349     }
1350 }