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