View Javadoc
1   package org.apache.maven.plugins.checkstyle.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.util.Collections;
24  import java.util.List;
25  
26  import org.apache.maven.artifact.DependencyResolutionRequiredException;
27  import org.apache.maven.model.Build;
28  import org.apache.maven.model.Organization;
29  import org.apache.maven.model.ReportPlugin;
30  import org.apache.maven.project.MavenProject;
31  import org.codehaus.plexus.PlexusTestCase;
32  
33  /**
34   *
35   */
36  public class MultiMavenProjectStub
37      extends CheckstyleProjectStub
38  {
39  
40      public MultiMavenProjectStub()
41      {
42          setExecutionRoot( true );
43      }
44  
45      @Override
46      public MavenProject getExecutionProject()
47      {
48          return this;
49      }
50  
51      /** {@inheritDoc} */
52      public List<String> getCompileClasspathElements()
53          throws DependencyResolutionRequiredException
54      {
55          return Collections.emptyList();
56      }
57  
58      /** {@inheritDoc} */
59      public List<String> getTestClasspathElements()
60          throws DependencyResolutionRequiredException
61      {
62          return Collections.emptyList();
63      }
64  
65      /** {@inheritDoc} */
66      public List<String> getCompileSourceRoots()
67      {
68          return Collections.emptyList();
69      }
70  
71      /** {@inheritDoc} */
72      public List<String> getTestCompileSourceRoots()
73      {
74          return Collections.emptyList();
75      }
76  
77      /** {@inheritDoc} */
78      public File getBasedir()
79      {
80          return new File( PlexusTestCase.getBasedir() );
81      }
82  
83      /** {@inheritDoc} */
84      public List<ReportPlugin> getReportPlugins()
85      {
86          ReportPlugin jxrPlugin = new ReportPlugin();
87  
88          jxrPlugin.setArtifactId( "maven-jxr-plugin" );
89  
90          return Collections.singletonList( jxrPlugin );
91      }
92  
93      /** {@inheritDoc} */
94      public Organization getOrganization()
95      {
96          Organization organization = new Organization();
97  
98          organization.setName( "maven-plugin-tests" );
99  
100         return organization;
101     }
102 
103     /** {@inheritDoc} */
104     public String getInceptionYear()
105     {
106         return "2006";
107     }
108 
109     /** {@inheritDoc} */
110     public Build getBuild()
111     {
112         Build build = new Build();
113 
114         build.setDirectory( PlexusTestCase.getBasedir() + "/target/test-harness/checkstyle/multi" );
115 
116         return build;
117     }
118 
119     /** {@inheritDoc} */
120     public File getFile()
121     {
122         File file = new File( getBasedir(), "pom.xml" );
123 
124         return file;
125     }
126 }