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.plugins.checkstyle.stubs;
20  
21  import java.io.File;
22  import java.util.ArrayList;
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  
31  /**
32   * @author Edwin Punzalan
33   *
34   */
35  public class ModuleMavenProjectStub extends CheckstyleProjectStub {
36  
37      /** {@inheritDoc} */
38      public List<String> getCompileClasspathElements() throws DependencyResolutionRequiredException {
39          return getCompileSourceRoots();
40      }
41  
42      /** {@inheritDoc} */
43      public List<String> getTestClasspathElements() throws DependencyResolutionRequiredException {
44          List<String> list = new ArrayList<>(getCompileClasspathElements());
45          list.add("target/test-classes");
46          return list;
47      }
48  
49      /** {@inheritDoc} */
50      public List<String> getCompileSourceRoots() {
51          return Collections.singletonList("target/classes");
52      }
53  
54      /** {@inheritDoc} */
55      public List<String> getTestCompileSourceRoots() {
56          List<String> list = new ArrayList<>(getCompileSourceRoots());
57          list.add("target/test-classes");
58          return list;
59      }
60  
61      /** {@inheritDoc} */
62      public List<ReportPlugin> getReportPlugins() {
63          ReportPlugin jxrPlugin = new ReportPlugin();
64  
65          jxrPlugin.setArtifactId("maven-jxr-plugin");
66  
67          return Collections.singletonList(jxrPlugin);
68      }
69  
70      /** {@inheritDoc} */
71      public Organization getOrganization() {
72          Organization organization = new Organization();
73  
74          organization.setName("maven-plugin-tests");
75  
76          return organization;
77      }
78  
79      /** {@inheritDoc} */
80      public String getInceptionYear() {
81          return "2006";
82      }
83  
84      /** {@inheritDoc} */
85      public Build getBuild() {
86          Build build = new Build();
87  
88          build.setDirectory("target/test-harness/checkstyle/multi");
89          build.setSourceDirectory("src/test/test-sources");
90          build.setTestSourceDirectory("src/test/java");
91  
92          return build;
93      }
94  
95      /** {@inheritDoc} */
96      public File getFile() {
97          File file = new File(getBasedir(), "pom.xml");
98  
99          return file;
100     }
101 }