View Javadoc

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