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/7/docs/technotes/tools/windows/javadoc.html#wheretags">Where Tags Can
38   * Be Used</a>.
39   *
40   * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
41   * @version $Id: TestFixJavadocMojo.html 943732 2015-03-14 00:06:30Z khmarbaise $
42   * @since 2.6
43   */
44  @Mojo( name = "test-fix", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true )
45  @Execute( phase = LifecyclePhase.TEST_COMPILE )
46  public class TestFixJavadocMojo
47      extends AbstractFixJavadocMojo
48  {
49      /** {@inheritDoc} */
50      protected List<String> getProjectSourceRoots( MavenProject p )
51      {
52          return ( p.getTestCompileSourceRoots() == null ? Collections.<String>emptyList()
53                          : new LinkedList<String>( p.getTestCompileSourceRoots() ) );
54      }
55  
56      /** {@inheritDoc} */
57      protected List<String> getCompileClasspathElements( MavenProject p )
58          throws DependencyResolutionRequiredException
59      {
60          return ( p.getTestClasspathElements() == null ? Collections.<String>emptyList()
61                          : new LinkedList<String>( p.getTestClasspathElements() ) );
62      }
63  
64      /** {@inheritDoc} */
65      protected String getArtifactType( MavenProject p )
66      {
67          return "test-jar";
68      }
69  
70      /** {@inheritDoc} */
71      public void execute()
72          throws MojoExecutionException, MojoFailureException
73      {
74          // clirr doesn't analyze test code, so ignore it
75          ignoreClirr = true;
76  
77          super.execute();
78      }
79  }