mirror of https://github.com/apache/maven.git
Fixing MNG-810: "create a mojo goal named -> javadoc:jar"
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@265765 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6120878e8d
commit
4bfe2cc1ab
|
@ -44,6 +44,16 @@
|
|||
<groupId>plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
<artifactId>plexus-archiver</artifactId>
|
||||
<version>1.0-alpha-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
<version>1.0-alpha-1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<developers>
|
||||
<developer>
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
package org.apache.maven.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* Copyright 2004-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.codehaus.plexus.archiver.ArchiverException;
|
||||
import org.codehaus.plexus.archiver.jar.JarArchiver;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @goal jar
|
||||
* @phase package
|
||||
* @execute phase="javadoc:javadoc"
|
||||
*/
|
||||
public class JavadocJar
|
||||
extends AbstractMojo
|
||||
{
|
||||
/**
|
||||
* @parameter expression="${project.build.directory}"
|
||||
*/
|
||||
private String outputDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.finalName}"
|
||||
*/
|
||||
private String finalName;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
try
|
||||
{
|
||||
generateArchive( outputDirectory + "/javadoc", finalName + "-javadoc.jar" );
|
||||
}
|
||||
catch ( ArchiverException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Error while creating archive.", e );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Error while creating archive.", e );
|
||||
}
|
||||
}
|
||||
|
||||
private void generateArchive( String source, String target )
|
||||
throws MojoExecutionException, ArchiverException, IOException
|
||||
{
|
||||
File javadocFiles = new File( source );
|
||||
|
||||
if ( !javadocFiles.exists() )
|
||||
{
|
||||
throw new MojoExecutionException( "javadoc files not found." );
|
||||
}
|
||||
|
||||
File javadocJar = new File( outputDirectory, target );
|
||||
|
||||
if ( javadocJar.exists() )
|
||||
{
|
||||
javadocJar.delete();
|
||||
}
|
||||
|
||||
JarArchiver archiver = new JarArchiver();
|
||||
|
||||
archiver.addDirectory( javadocFiles );
|
||||
|
||||
archiver.setDestFile( javadocJar );
|
||||
|
||||
archiver.createArchive();
|
||||
}
|
||||
}
|
|
@ -124,8 +124,7 @@ public class JavadocReport
|
|||
* Uses the sentence break iterator to determine the end of the first sentence.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#breakiterator">breakiterator</a>.
|
||||
*
|
||||
* @parameter expression="${breakiterator}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${breakiterator}" default-value="false"
|
||||
*/
|
||||
private boolean breakiterator = false;
|
||||
|
||||
|
@ -197,8 +196,7 @@ public class JavadocReport
|
|||
* This option created documentation with the appearance and functionality of documentation generated by Javadoc 1.1.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#1.1">1.1</a>.
|
||||
*
|
||||
* @parameter expression="${old}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${old}" default-value="false"
|
||||
*/
|
||||
private boolean old = false;
|
||||
|
||||
|
@ -214,8 +212,7 @@ public class JavadocReport
|
|||
* Shows only protected and public classes and members.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#package">package</a>.
|
||||
*
|
||||
* @parameter expression="${package}"
|
||||
* default-value="true"
|
||||
* @parameter expression="${package}" default-value="true"
|
||||
*/
|
||||
private boolean showPackage = true;
|
||||
|
||||
|
@ -223,8 +220,7 @@ public class JavadocReport
|
|||
* Shows only protected and public classes and members.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#protected">protected</a>.
|
||||
*
|
||||
* @parameter expression="${protected}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${protected}" default-value="false"
|
||||
*/
|
||||
private boolean showProtected = false;
|
||||
|
||||
|
@ -232,8 +228,7 @@ public class JavadocReport
|
|||
* Shows all classes and members.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#private">private</a>
|
||||
*
|
||||
* @parameter expression="${private}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${private}" default-value="false"
|
||||
*/
|
||||
private boolean showPrivate = false;
|
||||
|
||||
|
@ -241,8 +236,7 @@ public class JavadocReport
|
|||
* Shows only public classes and members.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#public">public</a>.
|
||||
*
|
||||
* @parameter expression="${public}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${public}" default-value="false"
|
||||
*/
|
||||
private boolean public_ = false;
|
||||
|
||||
|
@ -250,8 +244,7 @@ public class JavadocReport
|
|||
* Shuts off non-error and non-warning messages, leaving only the warnings and errors appear, making them easier to view.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#quiet">quiet</a>.
|
||||
*
|
||||
* @parameter expression="${quiet}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${quiet}" default-value="false"
|
||||
*/
|
||||
private boolean quiet = false;
|
||||
|
||||
|
@ -267,8 +260,7 @@ public class JavadocReport
|
|||
* Provides more detailed messages while javadoc is running.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#verbose">verbose</a>.
|
||||
*
|
||||
* @parameter expression="${verbose}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${verbose}" default-value="false"
|
||||
*/
|
||||
private boolean verbose = false;
|
||||
|
||||
|
@ -278,8 +270,7 @@ public class JavadocReport
|
|||
* Specifies whether or not the author text is included in the generated Javadocs.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#author">author</a>.
|
||||
*
|
||||
* @parameter expression="${author}"
|
||||
* default-value="true"
|
||||
* @parameter expression="${author}" default-value="true"
|
||||
*/
|
||||
private boolean author = true;
|
||||
|
||||
|
@ -287,8 +278,7 @@ public class JavadocReport
|
|||
* Specifies the text to be placed at the bottom of each output file.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#bottom">bottom</a>.
|
||||
*
|
||||
* @parameter expression="${bottom}"
|
||||
* default-value="Copyright ${project.inceptionYear-currentYear} ${project.organization.name}. All Rights Reserved."
|
||||
* @parameter expression="${bottom}" default-value="Copyright ${project.inceptionYear-currentYear} ${project.organization.name}. All Rights Reserved."
|
||||
*/
|
||||
private String bottom;
|
||||
|
||||
|
@ -296,8 +286,7 @@ public class JavadocReport
|
|||
* Specifies the HTML character set for this document.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#charset">charset</a>.
|
||||
*
|
||||
* @parameter expression="${charset}"
|
||||
* default-value="ISO-8859-1"
|
||||
* @parameter expression="${charset}" default-value="ISO-8859-1"
|
||||
*/
|
||||
private String charset = "ISO-8859-1";
|
||||
|
||||
|
@ -305,8 +294,7 @@ public class JavadocReport
|
|||
* Specifies the destination directory where javadoc saves the generated HTML files.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#d">d</a>.
|
||||
*
|
||||
* @parameter expression="${destDir}"
|
||||
* default-value="${project.build.directory}/site/apidocs"
|
||||
* @parameter expression="${destDir}" default-value="${project.build.directory}/site/apidocs"
|
||||
*/
|
||||
private String destDir;
|
||||
|
||||
|
@ -314,8 +302,7 @@ public class JavadocReport
|
|||
* Enables deep copying of "doc-files" directories.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#docfilessubdirs">docfilessubdirs</a>.
|
||||
*
|
||||
* @parameter expression="${docfilessubdirs}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${docfilessubdirs}" default-value="false"
|
||||
*/
|
||||
private boolean docfilessubdirs = false;
|
||||
|
||||
|
@ -331,8 +318,7 @@ public class JavadocReport
|
|||
* Specifies the title to be placed near the top of the overview summary file.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#doctitle">doctitle</a>.
|
||||
*
|
||||
* @parameter expression="${doctitle}"
|
||||
* default-value="${windowtitle}"
|
||||
* @parameter expression="${doctitle}" default-value="${project.name} ${project.version} API"
|
||||
*/
|
||||
private String doctitle;
|
||||
|
||||
|
@ -399,8 +385,7 @@ public class JavadocReport
|
|||
* Creates an HTML version of each source file (with line numbers) and adds links to them from the standard HTML documentation.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#linksource">linksource</a>.
|
||||
*
|
||||
* @parameter expression="${linksource}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${linksource}" default-value="false"
|
||||
*/
|
||||
private boolean linksource = false;
|
||||
|
||||
|
@ -408,8 +393,7 @@ public class JavadocReport
|
|||
* Suppress the entire comment body, including the main description and all tags, generating only declarations.
|
||||
* Ssee <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#nocomment">nocomment</a>.
|
||||
*
|
||||
* @parameter expression="${nocomment}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${nocomment}" default-value="false"
|
||||
*/
|
||||
private boolean nocomment = false;
|
||||
|
||||
|
@ -417,8 +401,7 @@ public class JavadocReport
|
|||
* Prevents the generation of any deprecated API at all in the documentation.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#nodeprecated">nodeprecated</a>.
|
||||
*
|
||||
* @parameter expression="${nodeprecated}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${nodeprecated}" default-value="false"
|
||||
*/
|
||||
private boolean nodeprecated = false;
|
||||
|
||||
|
@ -426,8 +409,7 @@ public class JavadocReport
|
|||
* Prevents the generation of the file containing the list of deprecated APIs (deprecated-list.html) and the link in the navigation bar to that page.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#nodeprecatedlist">nodeprecatedlist</a>.
|
||||
*
|
||||
* @parameter expression="${nodeprecatedlist}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${nodeprecatedlist}" default-value="false"
|
||||
*/
|
||||
private boolean nodeprecatedlist = false;
|
||||
|
||||
|
@ -435,8 +417,7 @@ public class JavadocReport
|
|||
* Omits the HELP link in the navigation bars at the top and bottom of each page of output.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#nohelp">nohelp</a>.
|
||||
*
|
||||
* @parameter expression="${nohelp}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${nohelp}" default-value="false"
|
||||
*/
|
||||
private boolean nohelp = false;
|
||||
|
||||
|
@ -444,8 +425,7 @@ public class JavadocReport
|
|||
* Omits the index from the generated docs.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#noindex">noindex</a>.
|
||||
*
|
||||
* @parameter expression="${noindex}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${noindex}" default-value="false"
|
||||
*/
|
||||
private boolean noindex = false;
|
||||
|
||||
|
@ -453,8 +433,7 @@ public class JavadocReport
|
|||
* Omits the index from the generated docs. The default value is 'false'.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#nonavbar">nonavbar</a>.
|
||||
*
|
||||
* @parameter expression="${nonavbar}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${nonavbar}" default-value="false"
|
||||
*/
|
||||
private boolean nonavbar = false;
|
||||
|
||||
|
@ -470,8 +449,7 @@ public class JavadocReport
|
|||
* Omits from the generated docs the "Since" sections associated with the since tags.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#nosince">nosince</a>.
|
||||
*
|
||||
* @parameter expression="${nosince}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${nosince}" default-value="false"
|
||||
*/
|
||||
private boolean nosince = false;
|
||||
|
||||
|
@ -479,8 +457,7 @@ public class JavadocReport
|
|||
* Omits the class/interface hierarchy pages from the generated docs.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#notree">notree</a>.
|
||||
*
|
||||
* @parameter expression="${notree}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${notree}" default-value="false"
|
||||
*/
|
||||
private boolean notree = false;
|
||||
|
||||
|
@ -488,8 +465,7 @@ public class JavadocReport
|
|||
* Generates compile-time warnings for missing serial tags.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#serialwarn">serialwarn</a>
|
||||
*
|
||||
* @parameter expression="${serialwarn}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${serialwarn}" default-value="false"
|
||||
*/
|
||||
private boolean serialwarn = false;
|
||||
|
||||
|
@ -498,8 +474,7 @@ public class JavadocReport
|
|||
* start with non-alphabetical characters.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#splitindex">splitindex</a>.
|
||||
*
|
||||
* @parameter expression="${splitindex}"
|
||||
* default-value="false"
|
||||
* @parameter expression="${splitindex}" default-value="false"
|
||||
*/
|
||||
private boolean splitindex = false;
|
||||
|
||||
|
@ -540,8 +515,7 @@ public class JavadocReport
|
|||
* Includes one "Use" page for each documented class and package.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#use">use</a>.
|
||||
*
|
||||
* @parameter expression="${use}"
|
||||
* default-value="true"
|
||||
* @parameter expression="${use}" default-value="true"
|
||||
*/
|
||||
private boolean use = true;
|
||||
|
||||
|
@ -549,8 +523,7 @@ public class JavadocReport
|
|||
* Includes the version text in the generated docs.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#version">version</a>.
|
||||
*
|
||||
* @parameter expression="${version}"
|
||||
* default-value="true"
|
||||
* @parameter expression="${version}" default-value="true"
|
||||
*/
|
||||
private boolean version = true;
|
||||
|
||||
|
@ -559,8 +532,7 @@ public class JavadocReport
|
|||
* The default is '${project.name} ${project.version} API'.
|
||||
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#windowtitle">windowtitle</a>.
|
||||
*
|
||||
* @parameter expression="${windowtitle}"
|
||||
* default-value="${project.name} ${project.version} API"
|
||||
* @parameter expression="${windowtitle}" default-value="${project.name} ${project.version} API"
|
||||
*/
|
||||
private String windowtitle;
|
||||
|
||||
|
|
Loading…
Reference in New Issue