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