aheritier 2004/08/25 12:48:48 Modified: javadoc plugin.jelly javadoc/src/plugin-test/test07 project.xml javadoc/xdocs changes.xml Log: - Fix MPJAVADOC-40 - Fix the init that was done several times (because there was dots in the var) Revision Changes Path 1.60 +135 -134 maven-plugins/javadoc/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /home/cvs/maven-plugins/javadoc/plugin.jelly,v retrieving revision 1.59 retrieving revision 1.60 diff -u -r1.59 -r1.60 --- plugin.jelly 24 Aug 2004 12:57:16 -0000 1.59 +++ plugin.jelly 25 Aug 2004 19:48:48 -0000 1.60 @@ -34,16 +34,18 @@ <define:taglib uri="javadoc"> <define:tag name="init"> - <j:if test="${maven.javadoc.debug}"><ant:echo>javadoc init</ant:echo></j:if> - <!-- internal variables --> - <j:set scope="parent" var="internal.javadoc.jar" value="${maven.build.dir}/${maven.final.name}_javadoc.jar"/> - <j:set scope="parent" var="internal.javadoc.needed" value="null"/> - <j:set scope="parent" var="internal.javadoc.working.dir" value="${maven.build.dir}/javadoc"/> - <j:set scope="parent" var="internal.javadoc.src.tmp" value="${internal.javadoc.working.dir}/src"/> - - <j:if test="${maven.javadoc.debug}"> - <ant:echo> + <j:if test="${empty(internal_javadoc_needed)}"> + + <j:if test="${maven.javadoc.debug}"><ant:echo>javadoc init</ant:echo></j:if> + + <!-- internal variables --> + <j:set scope="parent" var="internal_javadoc_jar" value="${maven.build.dir}/${maven.final.name}_javadoc.jar"/> + <j:set scope="parent" var="internal_javadoc_working_dir" value="${maven.build.dir}/javadoc"/> + <j:set scope="parent" var="internal_javadoc_src_tmp" value="${internal_javadoc_working_dir}/src"/> + + <j:if test="${maven.javadoc.debug}"> + <ant:echo> ### Debug mode is on ### ================================== === java plugin properties === @@ -90,105 +92,95 @@ ================================== === javadoc internal variables === ================================== -internal.javadoc.jar = [${internal.javadoc.jar}] -internal.javadoc.needed = [${internal.javadoc.needed}] -internal.javadoc.working.dir = [${internal.javadoc.working.dir}] - </ant:echo> - </j:if> - <j:if test="not ${maven.javadoc.debug}"> - <ant:echo> +internal_javadoc_jar = [${internal_javadoc_jar}] +internal_javadoc_needed = [${internal_javadoc_needed}] +internal_javadoc_working_dir = [${internal_javadoc_working_dir}] + </ant:echo> + </j:if> + <j:if test="not ${maven.javadoc.debug}"> + <ant:echo> ### Debug mode is off ### - </ant:echo> - </j:if> - - <ant:mkdir dir="${internal.javadoc.working.dir}"/> - <ant:mkdir dir="${internal.javadoc.src.tmp}"/> - - <j:choose> - - <j:when test="${internal.javadoc.needed != null}"> - <!-- We have already decided if javadoc is needed --> - <j:if test="${maven.javadoc.debug}"><ant:echo>internal.javadoc.needed not null : ${internal.javadoc.needed}</ant:echo></j:if> - </j:when> - - <j:otherwise> + </ant:echo> + </j:if> + + <ant:mkdir dir="${internal_javadoc_working_dir}"/> + <ant:mkdir dir="${internal_javadoc_src_tmp}"/> + + <j:set var="internal_javadoc_needed" scope="parent" value="false" /> - <!-- test if sourceModifications are defined --> - <j:if test="${pom.build.sourceModifications!=null and !pom.build.sourceModifications.isEmpty()}"> - <j:if test="${maven.javadoc.debug}"><ant:echo>sourceModifications used.</ant:echo></j:if> - <util:tokenize var="sources.dirs" delim="${path.separator}">${context.getAntProject().getReferences().get('maven.compile.src.set')}</util:tokenize> - <ant:copy todir="${internal.javadoc.src.tmp}"> - <j:forEach var="dir" items="${sources.dirs}"> - <ant:fileset dir="${dir}"> - <ant:include name="**/*.java"/> - <ant:include name="**/doc-files/**/*"/> - <!-- handle source modifications --> - <j:forEach var="sm" items="${pom.build.sourceModifications}"> - <ant:available property="classPresent" classname="${sm.className}"/> - <j:if test="${classPresent != 'true'}"> - <j:forEach var="exclude" items="${sm.excludes}"> - <ant:exclude name="${exclude}"/> - </j:forEach> <!-- end sourceModification exclude --> - <j:forEach var="include" items="${sm.includes}"> - <ant:include name="${include}"/> - </j:forEach> <!-- end sourceModification include --> - </j:if> - </j:forEach> <!-- end sourceModification --> - </ant:fileset> - </j:forEach> - </ant:copy> - <ant:path id="internal.javadoc.sources"> - <ant:pathelement location="${internal.javadoc.src.tmp}"/> - </ant:path> - </j:if> - <!-- test if sourceModifications aren't defined --> - <j:if test="${pom.build.sourceModifications==null || pom.build.sourceModifications.isEmpty()}"> - <j:if test="${maven.javadoc.debug}"><ant:echo>sourceModifications not used.</ant:echo></j:if> - <ant:path id="internal.javadoc.sources"> - <ant:pathelement path="${context.getAntProject().getReferences().get('maven.compile.src.set')}"/> - </ant:path> + <!-- test if sourceModifications are defined --> + <j:if test="${not empty(pom.build.sourceModifications)}"> + <j:if test="${maven.javadoc.debug}"><ant:echo>sourceModifications used.</ant:echo></j:if> + <util:tokenize var="sources_dirs" delim="${path.separator}">${context.getAntProject().getReferences().get('maven.compile.src.set')}</util:tokenize> + <ant:copy todir="${internal_javadoc_src_tmp}"> + <j:forEach var="dir" items="${sources_dirs}"> + <ant:fileset dir="${dir}"> + <ant:include name="**/*.java"/> + <ant:include name="**/doc-files/**/*"/> + <!-- handle source modifications --> + <j:forEach var="sm" items="${pom.build.sourceModifications}"> + <ant:available property="classPresent" classname="${sm.className}"/> + <j:if test="${classPresent != 'true'}"> + <j:forEach var="exclude" items="${sm.excludes}"> + <ant:exclude name="${exclude}"/> + </j:forEach> <!-- end sourceModification exclude --> + <j:forEach var="include" items="${sm.includes}"> + <ant:include name="${include}"/> + </j:forEach> <!-- end sourceModification include --> + </j:if> + </j:forEach> <!-- end sourceModification --> + </ant:fileset> + </j:forEach> + </ant:copy> + <ant:path id="internal_javadoc_sources"> + <ant:pathelement location="${internal_javadoc_src_tmp}"/> + </ant:path> + </j:if> + <!-- test if sourceModifications aren't defined --> + <j:if test="${empty(pom.build.sourceModifications)}"> + <j:if test="${maven.javadoc.debug}"><ant:echo>sourceModifications not used.</ant:echo></j:if> + <ant:path id="internal_javadoc_sources"> + <ant:pathelement path="${context.getAntProject().getReferences().get('maven.compile.src.set')}"/> + </ant:path> + </j:if> + + <!-- Tokenize the set of directories --> + <util:tokenize var="sources_dirs" delim="${path.separator}">${context.getAntProject().getReferences().get('internal_javadoc_sources')}</util:tokenize> + + <!-- For each directory --> + <j:forEach var="dir" items="${sources_dirs}"> + <!-- If we have not already find sources --> + <j:if test="${internal_javadoc_needed != true}"> + <!-- We construct the fileset --> + <util:replace var="packageDir" newChar="/" oldChar="." value="${pom.package}" /> + <j:if test="${!empty(packageDir)}"> + <j:set var="includes" value="${packageDir}/**/*.java" /> + </j:if> + <j:if test="${empty(packageDir)}"> + <j:set var="includes" value="**/*.java" /> + </j:if> + <ant:fileScanner var="sources"> + <ant:fileset dir="${dir}"> + <ant:include name="${includes}" /> + </ant:fileset> + </ant:fileScanner> + + <j:set var="internal_javadoc_needed" scope="parent" + value="${sources.iterator().hasNext()}" /> </j:if> - - <!-- Tokenize the set of directories --> - <util:tokenize var="sources.dirs" delim="${path.separator}">${context.getAntProject().getReferences().get('internal.javadoc.sources')}</util:tokenize> - - <!-- For each directory --> - <j:forEach var="dir" items="${sources.dirs}"> - <!-- If we have not already find sources --> - <j:if test="${internal.javadoc.needed != true}"> - <!-- We construct the fileset --> - <util:replace var="packageDir" newChar="/" oldChar="." value="${pom.package}" /> - <j:if test="${!empty(packageDir)}"> - <j:set var="includes" value="${packageDir}/**/*.java" /> - </j:if> - <j:if test="${empty(packageDir)}"> - <j:set var="includes" value="**/*.java" /> - </j:if> - <ant:fileScanner var="sources"> - <ant:fileset dir="${dir}"> - <ant:include name="${includes}" /> - </ant:fileset> - </ant:fileScanner> - - <j:set var="internal.javadoc.needed" scope="parent" - value="${sources.iterator().hasNext()}" /> + </j:forEach> <!-- dir in internal.javadoc.src.set --> - </j:if> - </j:forEach> <!-- dir in internal.javadoc.src.set --> - - </j:otherwise> - </j:choose> - - <j:if test="${maven.javadoc.debug}"> - <ant:echo>internal.javadoc.needed is ${internal.javadoc.needed}</ant:echo> + <j:if test="${maven.javadoc.debug}"> + <ant:echo>internal_javadoc_needed is ${internal_javadoc_needed}</ant:echo> + </j:if> </j:if> - </define:tag> + <define:jellybean name="javadocwarnings" className="org.apache.maven.javadoc.JavadocWarningsTextToXml" method="build" - /> + /> </define:taglib> @@ -200,7 +192,7 @@ <javadoc:init/> - <j:if test="${internal.javadoc.needed}"> + <j:if test="${internal_javadoc_needed}"> <doc:registerReport name="JavaDocs" pluginName="maven-javadoc-plugin" @@ -227,7 +219,7 @@ <javadoc:init/> - <j:if test="${internal.javadoc.needed}"> + <j:if test="${internal_javadoc_needed}"> <doc:deregisterReport name="JavaDocs"/> <doc:deregisterReport name="JavaDoc Report"/> @@ -245,9 +237,9 @@ <javadoc:init/> - <ant:mkdir dir="${maven.javadoc.destdir}"/> - - <j:if test="${internal.javadoc.needed}"> + <j:if test="${internal_javadoc_needed}"> + + <ant:mkdir dir="${maven.javadoc.destdir}"/> <!-- Get the year to display in the Javadocs --> <ant:tstamp> @@ -287,8 +279,8 @@ <j:set var="maxMemory" value="${maven.javadoc.maxmemory}" /> - <ant:mkdir dir="${internal.javadoc.working.dir}" /> - <ant:record name="${internal.javadoc.working.dir}/report.txt" action="start" /> + <ant:mkdir dir="${internal_javadoc_working_dir}" /> + <ant:record name="${internal_javadoc_working_dir}/report.txt" action="start" /> <j:choose> <j:when test="${pom.package != null and !pom.package.equals('')}"> @@ -317,12 +309,12 @@ > <ant:sourcepath> - <ant:path refid="internal.javadoc.sources"/> + <ant:path refid="internal_javadoc_sources"/> </ant:sourcepath> <j:if test="${pom.package == null or pom.package.equals('')}"> - <util:tokenize var="sources.dirs" delim="${path.separator}">${context.getAntProject().getReferences().get('maven.compile.src.set')}</util:tokenize> - <j:forEach var="dir" items="${sources.dirs}"> + <util:tokenize var="sources_dirs" delim="${path.separator}">${context.getAntProject().getReferences().get('maven.compile.src.set')}</util:tokenize> + <j:forEach var="dir" items="${sources_dirs}"> <ant:fileset dir="${dir}"> <ant:include name="*.java"/> </ant:fileset> @@ -436,9 +428,9 @@ --> <ant:copy todir="${maven.javadoc.destdir}"> - <util:tokenize var="sources.dirs" delim="${path.separator}">${context.getAntProject().getReferences().get('maven.compile.src.set')}</util:tokenize> + <util:tokenize var="sources_dirs" delim="${path.separator}">${context.getAntProject().getReferences().get('maven.compile.src.set')}</util:tokenize> - <j:forEach var="dir" items="${sources.dirs}"> + <j:forEach var="dir" items="${sources_dirs}"> <ant:fileset dir="${dir}"> <ant:include name="**/doc-files/**/*"/> </ant:fileset> @@ -446,12 +438,12 @@ </ant:copy> </j:if> - <ant:record name="${internal.javadoc.working.dir}/report.txt" action="stop" /> + <ant:record name="${internal_javadoc_working_dir}/report.txt" action="stop" /> <j:set var="genDocs" value="${maven.gen.docs}" /> <!-- load file in order to remove absolute paths --> - <util:file name="${internal.javadoc.working.dir}/report.txt" var="inputFileObject"/> + <util:file name="${internal_javadoc_working_dir}/report.txt" var="inputFileObject"/> <util:loadText var="inputText" file="${inputFileObject}"/> <!-- remove [javadoc] prefix from rows --> @@ -485,12 +477,12 @@ <javadoc:javadocwarnings verbose="${maven.javadoc.debug}" - inputFileName="${internal.javadoc.working.dir}/report.txt" - outputFileName="${internal.javadoc.working.dir}/javadoc-warnings.xml" + 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" + input="${internal_javadoc_working_dir}/javadoc-warnings.xml" output="javadoc-warnings-report.xml" stylesheet="${plugin.resources}/javadoc-warnings.jsl" encoding="${maven.docs.outputencoding}" @@ -498,12 +490,14 @@ prettyPrint="true" /> - <ant:delete dir="${internal.javadoc.src.tmp}"/> + <ant:delete dir="${internal_javadoc_src_tmp}"/> </j:if> - <j:if test="not ${internal.javadoc.needed}"> - <ant:echo>No sources found. Javadoc not created !</ant:echo> + <j:if test="${not internal_javadoc_needed}"> + <ant:echo>*******************************************</ant:echo> + <ant:echo>* No sources found. Javadoc not created ! *</ant:echo> + <ant:echo>*******************************************</ant:echo> </j:if> </goal> @@ -515,13 +509,16 @@ <!-- Create a jar file containing the javadoc --> <!--==================================================================--> <goal name="javadoc:jar" prereqs="javadoc"> - <j:set var="maven.javadoc.final.name" - value="${internal.javadoc.jar}" /> - <ant:jar - destfile="${maven.javadoc.final.name}" - basedir="${maven.javadoc.destdir}" - update="true"> - </ant:jar> + + <j:if test="${internal_javadoc_needed}"> + <j:set var="maven.javadoc.final.name" + value="${internal_javadoc_jar}" /> + <ant:jar + destfile="${maven.javadoc.final.name}" + basedir="${maven.javadoc.destdir}" + update="true"> + </ant:jar> + </j:if> </goal> <!--==================================================================--> @@ -530,12 +527,13 @@ <goal name="javadoc:install" prereqs="javadoc:jar" description="Install the jar containing javadoc in the local repository"> - - <artifact:install + + <j:if test="${internal_javadoc_needed}"> + <artifact:install artifact="${maven.javadoc.final.name}" type="javadoc.jar" project="${pom}"/> - + </j:if> </goal> <!--==================================================================--> @@ -544,12 +542,13 @@ <goal name="javadoc:install-snapshot" prereqs="javadoc:jar" description="Install the snapshot version of the jar containing javadoc in the local repository"> - + + <j:if test="${internal_javadoc_needed}"> <artifact:install-snapshot artifact="${maven.javadoc.final.name}" type="javadoc.jar" project="${pom}"/> - + </j:if> </goal> <!--==================================================================--> @@ -559,11 +558,12 @@ prereqs="javadoc:jar" description="Deploys the jar containing javadoc to the remote repository"> - <artifact:deploy + <j:if test="${internal_javadoc_needed}"> + <artifact:deploy artifact="${maven.javadoc.final.name}" type="javadoc.jar" project="${pom}"/> - + </j:if> </goal> <!--==================================================================--> @@ -573,11 +573,12 @@ prereqs="javadoc:jar" description="Deploys the snapshot version of jar containing javadoc to remote repository"> - <artifact:deploy-snapshot + <j:if test="${internal_javadoc_needed}"> + <artifact:deploy-snapshot artifact="${maven.javadoc.final.name}" type="javadoc.jar" project="${pom}"/> - + </j:if> </goal> <!-- ================================================================== --> 1.2 +2 -2 maven-plugins/javadoc/src/plugin-test/test07/project.xml Index: project.xml =================================================================== RCS file: /home/cvs/maven-plugins/javadoc/src/plugin-test/test07/project.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- project.xml 24 Aug 2004 13:04:31 -0000 1.1 +++ project.xml 25 Aug 2004 19:48:48 -0000 1.2 @@ -31,8 +31,8 @@ </organization> <inceptionYear>2001</inceptionYear> <logo>http://maven.apache.org/images/maven.jpg</logo> - <description>MPJAVADOC-40</description> - <shortDescription>MPJAVADOC-40</shortDescription> + <description>javadoc:jar fails if project doesn't have source files</description> + <shortDescription>javadoc:jar fails if project doesn't have source files</shortDescription> <url>http://maven.apache.org/reference/plugins/javadoc/index.html</url> <siteDirectory>/www/maven.apache.org/reference/plugins/javadoc/</siteDirectory> <repository> 1.49 +1 -0 maven-plugins/javadoc/xdocs/changes.xml Index: changes.xml =================================================================== RCS file: /home/cvs/maven-plugins/javadoc/xdocs/changes.xml,v retrieving revision 1.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- changes.xml 21 Aug 2004 23:25:37 -0000 1.48 +++ changes.xml 25 Aug 2004 19:48:48 -0000 1.49 @@ -27,6 +27,7 @@ </properties> <body> <release version="1.7-SNAPSHOT" date="In CVS"> + <action dev="aheritier" type="fix" issue="MPJAVADOC-40">javadoc:jar fails if project doesn't have source files.</action> <action dev="aheritier" type="fix" issue="MPJAVADOC-38">The type for the javadoc is "javadoc.jar" when it is deployed on a repository.</action> <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>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]