View Javadoc

1   package org.apache.maven.plugin.javadoc;
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.util.Collections;
23  import java.util.LinkedList;
24  import java.util.List;
25  
26  import org.apache.maven.artifact.DependencyResolutionRequiredException;
27  import org.apache.maven.plugin.MojoExecutionException;
28  import org.apache.maven.plugin.MojoFailureException;
29  import org.apache.maven.project.MavenProject;
30  
31  /**
32   * Fix Javadoc documentation and tags for the <code>Test Java code</code> for the project.
33   * See <a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html#wheretags">Where Tags Can Be Used</a>.
34   *
35   * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
36   * @version $Id: TestFixJavadocMojo.html 829394 2012-08-19 17:31:42Z hboutemy $
37   * @since 2.6
38   * @goal test-fix
39   * @requiresDependencyResolution test
40   * @execute phase="test-compile"
41   */
42  public class TestFixJavadocMojo
43      extends AbstractFixJavadocMojo
44  {
45      /** {@inheritDoc} */
46      protected List getProjectSourceRoots( MavenProject p )
47      {
48          return ( p.getTestCompileSourceRoots() == null ? Collections.EMPTY_LIST
49                          : new LinkedList( p.getTestCompileSourceRoots() ) );
50      }
51  
52      /** {@inheritDoc} */
53      protected List getCompileClasspathElements( MavenProject p )
54          throws DependencyResolutionRequiredException
55      {
56          return ( p.getTestClasspathElements() == null ? Collections.EMPTY_LIST
57                          : new LinkedList( p.getTestClasspathElements() ) );
58      }
59  
60      /** {@inheritDoc} */
61      protected String getArtifactType( MavenProject p )
62      {
63          return "test-jar";
64      }
65  
66      /** {@inheritDoc} */
67      public void execute()
68          throws MojoExecutionException, MojoFailureException
69      {
70          // clirr doesn't analyze test code, so ignore it
71          ignoreClirr = true;
72  
73          super.execute();
74      }
75  }