View Javadoc

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