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 MinMavenProjectStub extends CheckstyleProjectStub {
35      /** {@inheritDoc} */
36      public List<String> getCompileClasspathElements() throws DependencyResolutionRequiredException {
37          return getCompileSourceRoots();
38      }
39  
40      /** {@inheritDoc} */
41      public List<String> getTestClasspathElements() throws DependencyResolutionRequiredException {
42          List<String> list = new ArrayList<>(getCompileClasspathElements());
43          list.add(getBasedir() + "/target/test-classes");
44          return list;
45      }
46  
47      /** {@inheritDoc} */
48      public List<String> getCompileSourceRoots() {
49          return Collections.singletonList(getBasedir() + "/target/classes");
50      }
51  
52      /** {@inheritDoc} */
53      public List<String> getTestCompileSourceRoots() {
54          List<String> list = new ArrayList<>(getCompileSourceRoots());
55          list.add(getBasedir() + "/target/test-classes");
56          return list;
57      }
58  
59      /** {@inheritDoc} */
60      public List<ReportPlugin> getReportPlugins() {
61          ReportPlugin jxrPlugin = new ReportPlugin();
62  
63          jxrPlugin.setArtifactId("maven-jxr-plugin");
64  
65          return Collections.singletonList(jxrPlugin);
66      }
67  
68      /** {@inheritDoc} */
69      public Organization getOrganization() {
70          Organization organization = new Organization();
71  
72          organization.setName("maven-plugin-tests");
73  
74          return organization;
75      }
76  
77      /** {@inheritDoc} */
78      public String getInceptionYear() {
79          return "2006";
80      }
81  
82      /** {@inheritDoc} */
83      public Build getBuild() {
84          Build build = new Build();
85  
86          build.setDirectory(getBasedir() + "/target/test-harness/checkstyle/min");
87  
88          return build;
89      }
90  
91      @Override
92      protected String getPOM() {
93          return "min-plugin-config.xml";
94      }
95  }