aheritier 2004/08/21 11:42:05 Modified: javadoc plugin.jelly plugin.properties project.xml javadoc/src/plugin-test/test01 maven.xml javadoc/src/plugin-test/test05 project.xml javadoc/xdocs changes.xml Added: javadoc project.properties javadoc/src/main/org/apache/maven/javadoc JavadocWarningsTextToXml.java javadoc/src/plugin-resources javadoc-warnings.jsl javadoc/src/test report.txt javadoc/src/test/org/apache/maven/javadoc JavadocWarningsTextToXmlTest.java Log: MPJAVADOC-35 : Add javadoc warning report formatted similar to Checkstyle report TODO : Add a plugin test case Revision Changes Path 1.56 +32 -1 maven-plugins/javadoc/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /home/cvs/maven-plugins/javadoc/plugin.jelly,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- plugin.jelly 21 Aug 2004 14:37:41 -0000 1.55 +++ plugin.jelly 21 Aug 2004 18:42:04 -0000 1.56 @@ -51,12 +51,16 @@ maven.compile.encoding = [${maven.compile.encoding}] maven.compile.src.set = [${context.getAntProject().getReferences().get('maven.compile.src.set')}] ================================== +=== docs properties === +================================== +maven.docs.outputencoding = [${maven.docs.outputencoding}] +================================== === javadoc plugin properties === ================================== maven.javadoc.additionalparam = [${maven.javadoc.additionalparam}] maven.javadoc.author = [${maven.javadoc.author}] maven.javadoc.customtags = [${maven.javadoc.customtags}] -maven.javadoc.bottom = [${maven.javadoc.bottom}] +maven.javadoc.bottom = [${maven.javadoc.bottom}] maven.javadoc.debug = [${maven.javadoc.debug}] maven.javadoc.destdir = [${maven.javadoc.destdir}] maven.javadoc.doclet = [${maven.javadoc.doclet}] @@ -180,6 +184,11 @@ </j:if> </define:tag> + <define:jellybean + name="javadocwarnings" + className="org.apache.maven.javadoc.JavadocWarningsTextToXml" + method="build" + /> </define:taglib> @@ -205,6 +214,12 @@ link="javadoc" description="Report on the generation of JavaDoc." /> + <doc:registerReport + name="JavaDoc Warnings Report" + pluginName="" + link="javadoc-warnings-report" + description="Formatted report of JavaDoc warnings." + /> </j:if> </goal> @@ -216,6 +231,7 @@ <doc:deregisterReport name="JavaDocs"/> <doc:deregisterReport name="JavaDoc Report"/> + <doc:deregisterReport name="JavaDoc Warnings Report"/> </j:if> </goal> @@ -438,6 +454,21 @@ section="Javadoc Report" inputText="${inputText}" output="${genDocs}/javadoc.xml"/> + + <javadoc:javadocwarnings + verbose="${maven.javadoc.debug}" + inputFileName="${internal.javadoc.working.dir}/report.txt" + outputFileName="${internal.javadoc.working.dir}/javadoc-warnings.xml" + outputEncoding="${maven.docs.outputencoding}" + /> + <doc:jsl + input="${internal.javadoc.working.dir}/javadoc-warnings.xml" + output="javadoc-warnings-report.xml" + stylesheet="${plugin.resources}/javadoc-warnings.jsl" + encoding="${maven.docs.outputencoding}" + outputMode="xml" + prettyPrint="true" + /> <ant:delete dir="${internal.javadoc.src.tmp}"/> 1.18 +1 -1 maven-plugins/javadoc/plugin.properties Index: plugin.properties =================================================================== RCS file: /home/cvs/maven-plugins/javadoc/plugin.properties,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- plugin.properties 21 Aug 2004 14:37:41 -0000 1.17 +++ plugin.properties 21 Aug 2004 18:42:04 -0000 1.18 @@ -51,4 +51,4 @@ maven.javadoc.use = true maven.javadoc.useexternalfile = yes maven.javadoc.version = true -maven.javadoc.windowtitle = ${pom.name} ${pom.currentVersion} API \ No newline at end of file +maven.javadoc.windowtitle = ${pom.name} ${pom.currentVersion} API 1.45 +32 -0 maven-plugins/javadoc/project.xml Index: project.xml =================================================================== RCS file: /home/cvs/maven-plugins/javadoc/project.xml,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- project.xml 21 Aug 2004 14:27:17 -0000 1.44 +++ project.xml 21 Aug 2004 18:42:04 -0000 1.45 @@ -124,4 +124,36 @@ <version>2.0</version> </dependency> </dependencies> + <build> + <sourceDirectory>src/main</sourceDirectory> + <unitTestSourceDirectory>src/test</unitTestSourceDirectory> + <unitTest> + <includes> + <include>**/*Test.java</include> + </includes> + <resources> + <resource> + <directory>src/test</directory> + <includes> + <include>**/*.txt</include> + </includes> + </resource> + </resources> + </unitTest> + <resources> + <resource> + <directory>${basedir}/src/plugin-resources</directory> + <targetPath>plugin-resources</targetPath> + </resource> + <resource> + <directory>${basedir}</directory> + <includes> + <include>plugin.jelly</include> + <include>plugin.properties</include> + <include>project.properties</include> + <include>project.xml</include> + </includes> + </resource> + </resources> + </build> </project> 1.8 +1 -0 maven-plugins/javadoc/project.properties 1.1 maven-plugins/javadoc/src/main/org/apache/maven/javadoc/JavadocWarningsTextToXml.java Index: JavadocWarningsTextToXml.java =================================================================== package org.apache.maven.javadoc; /* ==================================================================== * Copyright 2001-2004 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.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeMap; /** * Converts the javadoc warnings into an xml (xdoc format) file. * * @author Steven Caswell (stevencaswell at apache.org) * @version $Id: JavadocWarningsTextToXml.java,v 1.1 2004/08/21 18:42:04 aheritier Exp $ */ public class JavadocWarningsTextToXml { //~ Static fields/initializers ---------------------------------------------- /** Number of args on the command line.*/ private static final int ARGS_LENGTH = 3; /** XML padding. */ private static final int PADDING = 10; //~ Instance fields --------------------------------------------------------- /** Full path for the input file (javadoc plain text report). */ private String inputFileName; /** XML encoding. */ private String outputEncoding; /** Full path for the generated XDoc file. */ private String outputFileName; /** Verbose flag. */ private boolean verbose = false; //~ Methods ----------------------------------------------------------------- /** * Invokes an instance of <code>JavadocWarningsTextToXml</code> from the * command line. The following command line arguments are expected in this * order: * * <ol> * <li> * input file name * </li> * <li> * output file name * </li> * <li> * output encoding * </li> * </ol> * * * @param args the command line arguments * * @throws IOException if an exception occurs opening, reading, or writing * files * @throws IllegalArgumentException if arguments aren't correctly setted. */ public static void main(final String[] args) throws IOException { if (args.length != ARGS_LENGTH) { throw new IllegalArgumentException("Wrong number of arguments"); } JavadocWarningsTextToXml runner = new JavadocWarningsTextToXml(); int i = 0; runner.setInputFileName(args[i++]); runner.setOutputFileName(args[i++]); runner.setOutputEncoding(args[i++]); runner.build(); } /** * Sets the name of the input file. This file is expected to be a report * generated by Javadoc. * * @param inputFileName the input file name */ public void setInputFileName(final String inputFileName) { if (this.isVerbose()) { System.out.println("Setting input file name: '" + inputFileName + "'"); } this.inputFileName = inputFileName; } /** * Returns the name of the input file. * * @return the inptu file name */ public String getInputFileName() { return this.inputFileName; } /** * Sets the output encoding. * * @param outputEncoding the output encoding */ public void setOutputEncoding(final String outputEncoding) { this.outputEncoding = outputEncoding; } /** * Returns the output encoding. * * @return the output encoding */ public String getOutputEncoding() { return this.outputEncoding; } /** * Sets the output file name. * * @param outputFileName the output file name */ public void setOutputFileName(final String outputFileName) { if (this.isVerbose()) { System.out.println("Setting output file name: '" + outputFileName + "'"); } this.outputFileName = outputFileName; } /** * Returns the name of the output file. * * @return the output file name */ public String getOutputFileName() { return this.outputFileName; } /** * Sets the verbose mode. <br> * * @param verbose the verbose mode. */ public void setVerbose(final boolean verbose) { this.verbose = verbose; if (this.isVerbose()) { System.out.println("verbose is true"); } } /** * Builds the xml file from the javadoc report input. * * @throws FileNotFoundException if the input file cannot be opened for * reading or the output file cannot be opened for writing * @throws IOException if an error occurs reading or writing * @throws UnsupportedEncodingException if an unknown encoding was specified * @throws IllegalArgumentException If a needed property isn't setted. */ public void build() throws FileNotFoundException, IOException, UnsupportedEncodingException { if (StringUtils.isBlank(getInputFileName())) { throw new IllegalArgumentException("Input file name must be specified"); } if (StringUtils.isBlank(getOutputFileName())) { throw new IllegalArgumentException("Output file name must be specified"); } String[] lines = this.readInput(); Map fileMap = this.buildMap(lines); this.buildOutput(fileMap); } /** * Returns the verbose. * * @return Returns the verbose. */ public boolean isVerbose() { return verbose; } private Map buildMap(final String[] input) { if (this.isVerbose()) { System.out.println( "Building map from " + input.length + " input line(s)" ); } Map files = new TreeMap(); for (int i = 0; i < input.length; i++) { String line = input[i]; // Break up line into pieces int javaDocStart = line.indexOf("[javadoc]"); int fileNameStart = javaDocStart += PADDING; int warningStart = line.indexOf("warning - "); int fileNameEnd = warningStart - 1; String fileNameAndLineNumber = line.substring( fileNameStart, fileNameEnd ); int lastColon = fileNameAndLineNumber.lastIndexOf(':'); int nextToLastColon = fileNameAndLineNumber.lastIndexOf( ':', lastColon - 1 ); String fileName = fileNameAndLineNumber.substring( 0, nextToLastColon ); String lineNumber = fileNameAndLineNumber.substring( nextToLastColon + 1, lastColon ); int msgStart = warningStart + PADDING; String msg = line.substring(msgStart); // Get the messages for the file Map fileMessages = (Map) files.get(fileName); if (fileMessages == null) { fileMessages = new TreeMap(); files.put( fileName, fileMessages ); } // Get the messages for the line Set lineMessages = (Set) fileMessages.get(new Integer(lineNumber)); if (lineMessages == null) { lineMessages = new LinkedHashSet(); fileMessages.put( new Integer(lineNumber), lineMessages ); } // Put the message into the line messages set lineMessages.add(msg); } return files; } private void buildOutput(final Map fileMap) throws FileNotFoundException, UnsupportedEncodingException { File output = new File(this.outputFileName); File dir = output.getParentFile(); if (dir != null) { dir.mkdirs(); } PrintWriter out = new PrintWriter( new OutputStreamWriter( new FileOutputStream(output), this.getOutputEncoding() ) ); writeOutput( fileMap, out ); out.flush(); out.close(); } private String[] readInput() throws FileNotFoundException, IOException { if (this.isVerbose()) { System.out.println("Reading '" + getInputFileName() + "'"); } BufferedReader reader = new BufferedReader(new FileReader(getInputFileName())); List lines = new ArrayList(); String line = null; while ((line = reader.readLine()) != null) { // Look for lines containing the string "warning - " if (line.indexOf("warning - ") >= 0) { lines.add(line); } } reader.close(); if (this.isVerbose()) { System.out.println("Read " + lines.size() + " line(s) from input file"); } return (String[]) lines.toArray(new String[lines.size()]); } private void writeOutput( final Map fileMap, final PrintWriter out ) { if (this.isVerbose()) { System.out.println("Writing to output file '" + this.outputFileName); } out.println( "<?xml version=\"1.0\" encoding=\"" + this.getOutputEncoding() + "\"?>" ); out.println("<javadoc>"); for ( Iterator fileMapIterator = fileMap.keySet() .iterator(); fileMapIterator.hasNext(); ) { String fileName = (String) fileMapIterator.next(); out.println("<file name=\"" + fileName + "\">"); Map fileMessages = (Map) fileMap.get(fileName); for ( Iterator fileMessagesIterator = fileMessages.entrySet() .iterator(); fileMessagesIterator.hasNext(); ) { Map.Entry entry = (Map.Entry) fileMessagesIterator.next(); Integer lineNumber = (Integer) entry.getKey(); Set lineMessages = (Set) entry.getValue(); for ( Iterator lineMessagesIterator = lineMessages.iterator(); lineMessagesIterator.hasNext(); ) { String msg = (String) lineMessagesIterator.next(); out.println( "<error line=\"" + lineNumber + "\" severity=\"warning\" message=\"" + StringEscapeUtils.escapeXml(msg) + "\"/>" ); } } out.println("</file>"); } out.println("</javadoc>"); if (this.isVerbose()) { System.out.println("Finished writing output file"); } } } 1.1 maven-plugins/javadoc/src/plugin-resources/javadoc-warnings.jsl Index: javadoc-warnings.jsl =================================================================== <?xml version="1.0"?> <!-- * ======================================================================== * * Copyright 2004 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. * * ======================================================================== --> <jsl:stylesheet select="$doc" xmlns:j="jelly:core" xmlns:jsl="jelly:jsl" xmlns:util="jelly:util" xmlns:x="jelly:xml" xmlns:doc="doc" xmlns="dummy" trim="false"> <!-- This needs to be instantiated here to be available in the template matches --> <j:useBean var="mavenTool" class="org.apache.maven.util.MavenTool"/> <j:useBean var="htmlescape" class="org.apache.velocity.anakia.Escape"/> <j:useBean var="fileutil" class="org.apache.velocity.texen.util.FileUtil"/> <j:useBean var="pathtool" class="org.apache.maven.util.DVSLPathTool"/> <jsl:template match="javadoc"> <document> <properties> <title>JavaDoc Audit Results</title> </properties> <body> <section name="JavaDoc Warnings"> <p> The following document contains JavaDoc warnings. </p> </section> <section name="Summary"> <j:set var="fileCount"><x:expr select="count(file)"/></j:set> <j:set var="errorCount"><x:expr select="count(file/error)"/></j:set> <table> <tr> <th>Files</th> <th width="75">Errors</th> </tr> <tr> <td><doc:formatAsNumber string="${fileCount}" pattern="0"/></td> <td><doc:formatAsNumber string="${errorCount}" pattern="0"/></td> </tr> </table> </section> <section name="Files"> <table> <tr> <th>Files</th> <th width="75">Errors</th> </tr> <j:set var="fullSrcDir" value="${pom.build.sourceDirectory}"/> <j:set var="srcDir" value="${fileutil.file(fullSrcDir).getCanonicalPath()}"/> <j:set var="srcDirLength" value="${srcDir.length() + 1}"/> <x:set var="files" select="file" sort="@name"/> <!-- x:forEach is busted --> <j:forEach var="file" items="${files}"> <!-- Type coercion doesn't work very well in jexl. --> <j:set var="name" value="${file.attribute('name').getValue()}"/> <j:set var="name" value="${name.substring(mavenTool.toInteger(srcDirLength.toString()))}"/> <util:replace var="name" value="${name}" oldChar="\\" newChar="/"/> <!--- +1 is for the trailing slash above --> <j:set var="errorCount"><x:expr select="count($file/error)"/></j:set> <j:if test="${errorCount != 0}"> <tr> <td> <a href="#${name}">${name}</a> </td> <td><doc:formatAsNumber string="${errorCount}" pattern="0"/></td> </tr> </j:if> </j:forEach> </table> <j:forEach var="file" items="${files}"> <x:set var="errorCount" select="count($file/error)"/> <j:if test="${errorCount != 0}"> <j:set var="name" value="${file.attribute('name').getValue()}"/> <j:set var="name" value="${name.substring(mavenTool.toInteger(srcDirLength.toString()))}"/> <util:replace var="name" value="${name}" oldChar="\\" newChar="/"/> <subsection name="${name}"> <table> <tr> <th>Error</th> <th width="75">Line</th> </tr> <x:set var="errors" select="$file/error"/> <j:forEach var="error" items="${errors}"> <tr> <td> <j:set var="errorMessage" value="${error.attribute('message').getValue()}"/> <!-- {htmlescape.getText(errorMessage)}-->${errorMessage} </td> <td> <j:set var="line" value="${error.attribute('line').getValue()}"/> <j:set var="lastIndex" value="${name.lastIndexOf('.java')}"/> <j:choose> <j:when test="${lastIndex > 0}"> <j:set var="index" value="${mavenTool.toInteger(lastIndex.toString())}"/> <j:set var="nameWithoutJavaExtension" value="${name.substring(0, index)}"/> <util:replace var="nameWithoutJavaExtension" value="${nameWithoutJavaExtension}" oldChar="\\" newChar="/"/> <a href="xref/${nameWithoutJavaExtension}.html#${line}">${line}</a> </j:when> <j:otherwise> ${line} </j:otherwise> </j:choose> </td> </tr> </j:forEach> </table> </subsection> </j:if> </j:forEach> </section> </body> </document> </jsl:template> </jsl:stylesheet> 1.2 +1 -1 maven-plugins/javadoc/src/plugin-test/test01/maven.xml Index: maven.xml =================================================================== RCS file: /home/cvs/maven-plugins/javadoc/src/plugin-test/test01/maven.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- maven.xml 9 Jul 2004 20:30:32 -0000 1.1 +++ maven.xml 21 Aug 2004 18:42:04 -0000 1.2 @@ -20,7 +20,7 @@ xmlns:j="jelly:core" xmlns:assert="assert" xmlns:ant="jelly:ant"> - + <goal name="testPlugin"> <delete dir="${maven.build.dir}" failonerror="false"/> <delete file="${maven.build.dir}/${maven.final.name}_javadoc.jar" failonerror="false"/> 1.2 +1 -0 maven-plugins/javadoc/src/plugin-test/test05/project.xml Index: project.xml =================================================================== RCS file: /home/cvs/maven-plugins/javadoc/src/plugin-test/test05/project.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- project.xml 29 Jul 2004 22:59:24 -0000 1.1 +++ project.xml 21 Aug 2004 18:42:05 -0000 1.2 @@ -62,4 +62,5 @@ <build> <sourceDirectory>src/main</sourceDirectory> </build> + </project> 1.1 maven-plugins/javadoc/src/test/report.txt Index: report.txt =================================================================== [javadoc] Generating Javadoc [javadoc] Javadoc execution [javadoc] Loading source files for package org.apache.maven... [javadoc] [parsing started C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc1.java] [javadoc] [parsing completed 120ms] [javadoc] [parsing started C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc2.java] [javadoc] [parsing completed 20ms] [javadoc] Constructing Javadoc information... [javadoc] C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc1.java:145: method3() is already defined in org.apache.maven.Javadoc1 [javadoc] public void method3() [javadoc] ^ [javadoc] Standard Doclet version 1.4.1 [javadoc] [javadoc] Generating C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\target\docs\apidocs\constant-values.html... [javadoc] Copying file C:\apache\maven-1.0-rc3\plugins\maven-javadoc-plugin-1.6.1\plugin-resources\stylesheet.css to file C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\target\docs\apidocs\stylesheet.css... [javadoc] Building tree for all the packages and classes... [javadoc] [loading C:\Java\j2sdk1.4.1_02\jre\lib\rt.jar(java/lang/Object.class)] [javadoc] Building index for all the packages and classes... [javadoc] C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc1.java:8: warning - @inheritDoc used but method1() does not override or implement any method. [javadoc] Generating C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\target\docs\apidocs\index-all.html... [javadoc] C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc2.java:15: Tag @link: Malformed: Javadoc1#method1( [javadoc] C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc2.java:15: warning - Tag @link: malformed: "Javadoc1#method1(" [javadoc] Building index for all classes... [javadoc] C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc1.java:8: warning - @inheritDoc used but method1() does not override or implement any method. [javadoc] C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc1.java:8: warning - @inheritDoc used but method1() does not override or implement any method. [javadoc] Generating C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\target\docs\apidocs\org\apache\maven\Javadoc1.html... [javadoc] [loading C:\Java\j2sdk1.4.1_02\jre\lib\rt.jar(java/io/Serializable.class)] [javadoc] C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc2.java:15: warning - Tag @link: malformed: "Javadoc1#method1(" [javadoc] Generating C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\target\docs\apidocs\org\apache\maven\Javadoc2.html... [javadoc] C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc2.java:15: Tag @link: Malformed: Javadoc1#method1( [javadoc] C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc2.java:15: warning - Tag @link: malformed: "Javadoc1#method1(" [javadoc] C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc2.java:8: warning - @todo is an unknown tag. [javadoc] C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc2.java:15: Tag @link: Malformed: Javadoc1#method1( [javadoc] C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc2.java:15: warning - Tag @link: malformed: "Javadoc1#method1(" [javadoc] C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc2.java:15: warning - Tag @link: malformed: "Javadoc1#method1(" [javadoc] C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\src\main\org\apache\maven\Javadoc2.java:15: warning - Tag @link: malformed: "Javadoc1#method1(" [javadoc] Generating C:\Steve\Java\dev\maven-plugin-dev\javadoc\cvs-sandbox\maven-plugins\javadoc\src\plugin-test\test05\target\docs\apidocs\help-doc.html... [javadoc] [done in 4065 ms] [javadoc] 11 warnings 1.1 maven-plugins/javadoc/src/test/org/apache/maven/javadoc/JavadocWarningsTextToXmlTest.java Index: JavadocWarningsTextToXmlTest.java =================================================================== package org.apache.maven.javadoc; /* ==================================================================== * Copyright 2001-2004 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 junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; /** * Test case. * * @author Steven Caswell * @version $Id: JavadocWarningsTextToXmlTest.java,v 1.1 2004/08/21 18:42:05 aheritier Exp $ */ public class JavadocWarningsTextToXmlTest extends TestCase { //~ Static fields/initializers ---------------------------------------------- private static final String INPUT_FILE_NAME_EXCEPTION = "Input file name must be specified"; private static final String OUTPUT_FILE_NAME_EXCEPTION = "Output file name must be specified"; //~ Constructors ------------------------------------------------------------ /** * Creates a new JavadocWarningsTextToXmlTest object. * */ public JavadocWarningsTextToXmlTest(final String name) { super(name); } //~ Methods ----------------------------------------------------------------- public static void main(final String[] main) { TestRunner.run(suite()); } public static Test suite() { return new TestSuite(JavadocWarningsTextToXmlTest.class); } /** * Initialize per test data * * @throws Exception when there is an unexpected problem */ public void setUp() throws Exception { String baseDir = System.getProperty("basedir"); System.out.println("Base dir : " + baseDir); assertNotNull( "The system property basedir was not defined.", baseDir ); } public void testBuild() throws Exception { JavadocWarningsTextToXml bean = new JavadocWarningsTextToXml(); bean.setVerbose(true); bean.setInputFileName("target/test-classes/report.txt"); bean.setOutputFileName("test.xml"); bean.setOutputEncoding("ISO-8859-1"); bean.build(); // Read and test the output file contents BufferedReader reader = new BufferedReader(new FileReader("test.xml")); String line = reader.readLine(); assertTrue( "line 1 start", line.startsWith("<?xml version=\"1.0\" encoding=\"") ); assertTrue( "line 1 end", line.endsWith("ISO-8859-1\"?>") ); line = reader.readLine(); assertEquals( "line 2", "<javadoc>", line ); line = reader.readLine(); assertTrue( "line 3 start", line.startsWith("<file name") ); assertTrue( "line 3 end", line.endsWith("Javadoc1.java\">") ); line = reader.readLine(); assertEquals( "line 4", "<error line=\"8\" severity=\"warning\" message=\"@inheritDoc used but method1() does not override or implement any method.\"/>", line ); line = reader.readLine(); assertEquals( "line 5", "</file>", line ); line = reader.readLine(); assertTrue( "line 6 start", line.startsWith("<file name") ); assertTrue( "line 6 end", line.endsWith("Javadoc2.java\">") ); line = reader.readLine(); assertEquals( "line 7", "<error line=\"8\" severity=\"warning\" message=\"@todo is an unknown tag.\"/>", line ); line = reader.readLine(); assertEquals( "line 8", "<error line=\"15\" severity=\"warning\" message=\"Tag @link: malformed: "Javadoc1#method1("\"/>", line ); line = reader.readLine(); assertEquals( "line 9", "</file>", line ); line = reader.readLine(); assertEquals( "line 10", "</javadoc>", line ); reader.close(); // Get rid of the xml file File file = new File("test.xml"); file.delete(); } public void testInputFile() throws Exception { JavadocWarningsTextToXml bean = new JavadocWarningsTextToXml(); bean.setOutputFileName("test.xml"); bean.setOutputEncoding("ISO-8859-1]"); try { bean.build(); } catch (IllegalArgumentException e) { assertEquals( "exception message", INPUT_FILE_NAME_EXCEPTION, e.getMessage() ); } } public void testInputFileNotFound() throws Exception { JavadocWarningsTextToXml bean = new JavadocWarningsTextToXml(); bean.setInputFileName("junk.dat"); bean.setOutputFileName("test.xml"); bean.setOutputEncoding("ISO-8859-1]"); try { bean.build(); fail("Expected null pointer exception for input file name"); } catch (FileNotFoundException e) { ; // expected file not found } } public void testOutputFile() throws Exception { JavadocWarningsTextToXml bean = new JavadocWarningsTextToXml(); bean.setInputFileName("report.txt"); bean.setOutputEncoding("ISO-8859-1]"); try { bean.build(); fail("Expected null pointer exception for input file name"); } catch (IllegalArgumentException e) { assertEquals( "exception message", OUTPUT_FILE_NAME_EXCEPTION, e.getMessage() ); } } } 1.47 +2 -0 maven-plugins/javadoc/xdocs/changes.xml Index: changes.xml =================================================================== RCS file: /home/cvs/maven-plugins/javadoc/xdocs/changes.xml,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- changes.xml 21 Aug 2004 14:37:41 -0000 1.46 +++ changes.xml 21 Aug 2004 18:42:05 -0000 1.47 @@ -23,9 +23,11 @@ <title>Changes</title> <author email="[EMAIL PROTECTED]">dIon Gillard</author> <author email="[EMAIL PROTECTED]">Emmanuel Venisse</author> + <author email="[EMAIL PROTECTED]">Arnaud Heritier</author> </properties> <body> <release version="1.7-SNAPSHOT" date="In CVS"> + <action dev="aheritier" type="add" issue="MPJAVADOC-35" due-to="Steven Caswell">Add javadoc warning report formatted similar to Checkstyle report.</action> <action dev="carlos" type="add" issue="MPJAVADOC-39">Added maven.javadoc.bottom property</action> <action dev="aheritier" type="fix" issue="MPJAVADOC-37">Default javadoc scope (package) can't be replaced by private or public.</action> <action dev="aheritier" type="fix" issue="MPJAVADOC-36">Javadoc fails if pom.package isn't specified.</action>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]