|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.maven.plugin.javadoc.JavadocUtil
public class JavadocUtil
Set of utilities methods for Javadoc.
Constructor Summary | |
---|---|
JavadocUtil()
|
Method Summary | |
---|---|
protected static void |
addFilesFromSource(java.util.List files,
java.io.File sourceDirectory,
java.lang.String[] excludePackages)
Convenience method that gets the files to be included in the javadoc. |
protected static void |
copyJavadocResources(java.io.File outputDirectory,
java.io.File javadocDir)
Deprecated. since 2.5, using copyJavadocResources(File, File, String) instead of. |
protected static void |
copyJavadocResources(java.io.File outputDirectory,
java.io.File javadocDir,
java.lang.String excludedocfilessubdir)
Convenience method that copy all doc-files directories from javadocDir
to the outputDirectory . |
protected static void |
fetchURL(org.apache.maven.settings.Settings settings,
java.net.URL url)
Fetch an URL |
protected static java.util.List |
getCompileArtifacts(java.util.Set artifacts)
Deprecated. since 2.5, using getCompileArtifacts(Set, boolean) instead of. |
protected static java.util.List |
getCompileArtifacts(java.util.Set artifacts,
boolean withTestScope)
Copy from MavenProject.getCompileArtifacts() |
protected static java.util.List |
getExcludedNames(java.util.List sourcePaths,
java.lang.String[] subpackagesList,
java.lang.String[] excludedPackages)
Method that gets all the source files to be excluded from the javadoc on the given source paths. |
protected static java.util.List |
getExcludedPackages(java.lang.String sourceDirectory,
java.lang.String[] excludePackagenames)
Method that gets the complete package names (including subpackages) of the packages that were defined in the excludePackageNames parameter. |
protected static java.util.List |
getIncludedFiles(java.io.File sourceDirectory,
java.lang.String[] fileList,
java.lang.String[] excludePackages)
Method that gets the files or classes that would be included in the javadocs using the subpackages parameter. |
protected static float |
getJavadocVersion(java.io.File javadocExe)
Call the Javadoc tool and parse its output to find its version, i.e.: javadoc.exe(or .sh) -J-version |
protected static java.util.List |
getTagletClassNames(java.io.File jarFile)
Auto-detect the class names of the implementation of com.sun.tools.doclets.Taglet class from a
given jar file. |
protected static java.lang.String |
hideProxyPassword(java.lang.String cmdLine,
org.apache.maven.settings.Settings settings)
For security reasons, if an active proxy is defined and needs an authentication by username/password, hide the proxy password in the command line. |
protected static java.lang.String |
parseJavadocMemory(java.lang.String memory)
Parse a memory string which be used in the JVM arguments -Xms or -Xmx . |
protected static float |
parseJavadocVersion(java.lang.String output)
Parse the output for 'javadoc -J-version' and return the javadoc version recognized. |
protected static java.util.List |
pruneDirs(org.apache.maven.project.MavenProject project,
java.util.List dirs)
Method that removes the invalid directories in the specified directories. |
protected static java.util.List |
pruneFiles(java.util.List files)
Method that removes the invalid files in the specified files. |
protected static java.lang.String |
quotedArgument(java.lang.String value)
Convenience method to wrap an argument value in single quotes (i.e. |
protected static java.lang.String |
quotedPathArgument(java.lang.String value)
Convenience method to format a path argument so that it is properly interpreted by the javadoc tool. |
protected static boolean |
validateEncoding(java.lang.String charsetName)
Validate if a charset is supported on this platform. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JavadocUtil()
Method Detail |
---|
protected static java.util.List pruneDirs(org.apache.maven.project.MavenProject project, java.util.List dirs)
dirs
could be an absolute or relative against the project's base
directory String
path.
project
- the current Maven project not nulldirs
- the list of String
directories path that will be validated.
String
directories absolute paths.protected static java.util.List pruneFiles(java.util.List files)
files
should be an absolute String
path.
files
- the list of String
files paths that will be validated.
File
objects.protected static java.util.List getExcludedNames(java.util.List sourcePaths, java.lang.String[] subpackagesList, java.lang.String[] excludedPackages)
sourcePaths
- the path to the source filessubpackagesList
- list of subpackages to be included in the javadocexcludedPackages
- the package names to be excluded in the javadoc
protected static java.util.List getCompileArtifacts(java.util.Set artifacts)
getCompileArtifacts(Set, boolean)
instead of.
MavenProject.getCompileArtifacts()
artifacts
- not null
protected static java.util.List getCompileArtifacts(java.util.Set artifacts, boolean withTestScope)
MavenProject.getCompileArtifacts()
artifacts
- not nullwithTestScope
- flag to include or not the artifacts with test scope
protected static java.lang.String quotedArgument(java.lang.String value)
'
). Intended for values
which may contain whitespaces.
\n
) are skipped.
value
- the argument value.
protected static java.lang.String quotedPathArgument(java.lang.String value)
value
- the argument value.
protected static void copyJavadocResources(java.io.File outputDirectory, java.io.File javadocDir) throws java.io.IOException
copyJavadocResources(File, File, String)
instead of.
doc-files
directories from javadocDir
to the outputDirectory
.
outputDirectory
- the output directoryjavadocDir
- the javadoc directory
java.io.IOException
- if anyprotected static void copyJavadocResources(java.io.File outputDirectory, java.io.File javadocDir, java.lang.String excludedocfilessubdir) throws java.io.IOException
doc-files
directories from javadocDir
to the outputDirectory
.
outputDirectory
- the output directoryjavadocDir
- the javadoc directoryexcludedocfilessubdir
- the excludedocfilessubdir parameter
java.io.IOException
- if anyprotected static java.util.List getIncludedFiles(java.io.File sourceDirectory, java.lang.String[] fileList, java.lang.String[] excludePackages)
sourceDirectory
- the directory where the source files are locatedfileList
- the list of all files found in the sourceDirectoryexcludePackages
- package names to be excluded in the javadoc
protected static java.util.List getExcludedPackages(java.lang.String sourceDirectory, java.lang.String[] excludePackagenames)
sourceDirectory
- the directory where the source files are locatedexcludePackagenames
- package names to be excluded in the javadoc
protected static void addFilesFromSource(java.util.List files, java.io.File sourceDirectory, java.lang.String[] excludePackages)
sourceDirectory
- the directory where the source files are locatedfiles
- the variable that contains the appended filenames of the files to be included in the javadocexcludePackages
- the packages to be excluded in the javadocsprotected static float getJavadocVersion(java.io.File javadocExe) throws java.io.IOException, org.codehaus.plexus.util.cli.CommandLineException, java.lang.IllegalArgumentException, java.util.regex.PatternSyntaxException
javadoc.exe(or .sh) -J-version
javadocExe
- not null file
java.io.IOException
- if javadocExe is null, doesn't exist or is not a file
org.codehaus.plexus.util.cli.CommandLineException
- if any
java.lang.IllegalArgumentException
- if no output was found in the command line
java.util.regex.PatternSyntaxException
- if the output contains a syntax error in the regular-expression pattern.parseJavadocVersion(String)
protected static float parseJavadocVersion(java.lang.String output) throws java.lang.IllegalArgumentException, java.util.regex.PatternSyntaxException
JDK | Output for 'javadoc -J-version' |
---|---|
Sun 1.4 | java full version "1.4.2_12-b03" |
Sun 1.5 | java full version "1.5.0_07-164" |
IBM 1.4 | javadoc full version "J2RE 1.4.2 IBM Windows 32 build cn1420-20040626" |
IBM 1.5 (French JVM) | javadoc version complète de "J2RE 1.5.0 IBM Windows 32 build pwi32pdev-20070426a" |
FreeBSD 1.5 | java full version "diablo-1.5.0-b01" |
BEA jrockit 1.5 | java full version "1.5.0_11-b03" |
output
- for 'javadoc -J-version'
java.util.regex.PatternSyntaxException
- if the output doesn't match with the output pattern
(?s).*?([0-9]+\\.[0-9]+)(\\.([0-9]+))?.*.
java.lang.IllegalArgumentException
- if the output is nullprotected static java.lang.String parseJavadocMemory(java.lang.String memory) throws java.lang.IllegalArgumentException
-Xms
or -Xmx
.
JDK | Memory argument support for -Xms or -Xmx |
---|---|
SUN | 1024k | 128m | 1g | 1t |
IBM | 1024k | 1024b | 128m | 128mb | 1g | 1gb |
BEA | 1024k | 1024kb | 128m | 128mb | 1g | 1gb |
memory
- the memory to be parsed, not null.
memory
parameter,
the default unit is m
. The units g | gb
or t | tb
will be converted
in m
.
java.lang.IllegalArgumentException
- if the memory
parameter is null or doesn't match any pattern.protected static void fetchURL(org.apache.maven.settings.Settings settings, java.net.URL url) throws java.io.IOException
settings
- the user settings used to fetch the url with an active proxy, if defined.url
- the url to fetch
java.io.IOException
- if anyprotected static boolean validateEncoding(java.lang.String charsetName)
charsetName
- the charsetName to be check.
true
if the charset is supported by the JVM, false
otherwise.protected static java.lang.String hideProxyPassword(java.lang.String cmdLine, org.apache.maven.settings.Settings settings)
cmdLine
- a command line, not nullsettings
- the user settings
protected static java.util.List getTagletClassNames(java.io.File jarFile) throws java.io.IOException, java.lang.ClassNotFoundException, java.lang.NoClassDefFoundError
com.sun.tools.doclets.Taglet
class from a
given jar file.
JAVA_HOME/lib/tools.jar
is a requirement to find
com.sun.tools.doclets.Taglet
class.
jarFile
- not null
com.sun.tools.doclets.Taglet
class names from a given jarFile.
java.io.IOException
- if jarFile is invalid or not found, or if the JAVA_HOME/lib/tools.jar
is not found.
java.lang.ClassNotFoundException
- if any
java.lang.NoClassDefFoundError
- if any
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |