evenisse 2004/02/06 05:42:40 Modified: javadoc plugin.jelly Log: MPJAVADOC-19. Prevent the plugin from failing when a sourceDirectory exists, but it does not contain Java files. Revision Changes Path 1.29 +168 -162 maven-plugins/javadoc/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /home/cvs/maven-plugins/javadoc/plugin.jelly,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- plugin.jelly 8 Jan 2004 00:24:53 -0000 1.28 +++ plugin.jelly 6 Feb 2004 13:42:40 -0000 1.29 @@ -43,178 +43,184 @@ <j:if test="${sourcesPresent == 'true'}"> - <ant:mkdir dir="${maven.javadoc.destdir}"/> + <ant:fileset id="sources" dir="${pom.build.sourceDirectory}"> + <ant:include name="**/*.java"/> + <!-- FIXME: This is a bad cut and paste --> + <!-- 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> + <j:forEach var="include" items="${sm.includes}"> + <ant:include name="${include}"/> + </j:forEach> + </j:if> + </j:forEach> + </ant:fileset> + + <!-- Only continue if there is any Java source file in the source dir --> + <j:if test="${sources.iterator().hasNext()}"> + + <ant:mkdir dir="${maven.javadoc.destdir}"/> + + <!-- Get the year to display in the Javadocs --> + <ant:tstamp> + <ant:format property="currentYear" pattern="yyyy"/> + </ant:tstamp> + <ant:tstamp> + <j:choose> + <j:when test="${pom.inceptionYear.equals(currentYear)}"> + <ant:format property="year" pattern="yyyy"/> + </j:when> + <j:otherwise> + <ant:format property="year" pattern="${pom.inceptionYear}-yyyy"/> + </j:otherwise> + </j:choose> + </ant:tstamp> + + <ant:property name="copyright" + value="Copyright &copy; ${year} ${pom.organization.name}. All Rights Reserved." /> + + <!-- calculate online/offline mode --> + <j:set var="online" value="${maven.javadoc.mode.online}"/> + <j:if test="${empty(online)}"> + <j:set var="online" value="${maven.mode.online}"/> + </j:if> - <!-- Get the year to display in the Javadocs --> - <ant:tstamp> - <ant:format property="currentYear" pattern="yyyy"/> - </ant:tstamp> - <ant:tstamp> <j:choose> - <j:when test="${pom.inceptionYear.equals(currentYear)}"> - <ant:format property="year" pattern="yyyy"/> + <j:when test="${online}"> + <util:tokenize var="links" delim="," trim="true">${maven.javadoc.links}</util:tokenize> + <j:forEach var="link" items="${links}"> + <ant:echo>Linking with API information from ${link.trim()} ...</ant:echo> + </j:forEach> </j:when> <j:otherwise> - <ant:format property="year" pattern="${pom.inceptionYear}-yyyy"/> + <util:tokenize var="links" delim="," trim="true">${maven.javadoc.offlineLinks}</util:tokenize> + <j:forEach var="link" items="${links}"> + <ant:echo>Linking offline API information from ${link.trim()} ...</ant:echo> + </j:forEach> </j:otherwise> </j:choose> - </ant:tstamp> - - <ant:property name="copyright" - value="Copyright &copy; ${year} ${pom.organization.name}. All Rights Reserved." /> - - <!-- calculate online/offline mode --> - <j:set var="online" value="${maven.javadoc.mode.online}"/> - <j:if test="${empty(online)}"> - <j:set var="online" value="${maven.mode.online}"/> - </j:if> - - <j:choose> - <j:when test="${online}"> - <util:tokenize var="links" delim="," trim="true">${maven.javadoc.links}</util:tokenize> + + <j:set var="maxMemory" value="${maven.javadoc.maxmemory}" /> + + <ant:mkdir dir="${maven.build.dir}/javadoc/" /> + <ant:record name="${maven.build.dir}/javadoc/report.txt" action="start" /> + + <ant:javadoc + packagenames="${pom.package}.*" + destdir="${maven.javadoc.destdir}" + author="${maven.javadoc.author}" + public="${maven.javadoc.public}" + package="${maven.javadoc.package}" + private="${maven.javadoc.private}" + version="${maven.javadoc.version}" + use="${maven.javadoc.use}" + windowtitle="${maven.javadoc.windowtitle}" + doctitle="${maven.javadoc.windowtitle}" + bottom="${copyright}" + stylesheetfile="${maven.javadoc.stylesheet}" + additionalparam="${maven.javadoc.additionalparam}" + useexternalfile="${maven.javadoc.useexternalfile}"> + + <ant:fileset refid="sources" /> + + <j:if test="${context.getVariable('maven.javadoc.source') != null}"> + <ant:setProperty name="source" value="${maven.javadoc.source}" /> + </j:if> + + <!-- Process/Parse links --> + <!-- This code allows to specify a packagelistLoc even when in online mode --> <j:forEach var="link" items="${links}"> - <ant:echo>Linking with API information from ${link.trim()} ...</ant:echo> + <j:set var="pos" value="${link.indexOf('#')}" /> + + <!-- set href and packagelistLoc --> + <j:choose> + <!-- I am bad with jelly, the test is: "pos == -1" --> + <j:when test="${1+pos == 0}"> + <j:set var="href" value="${link.trim()}" /> + <j:set var="packagelistLoc" value="${href}"/> + </j:when> + <j:otherwise> + <j:set var="href" value="${link.substring(0,pos).trim()}"/> + <j:set var="packagelistLoc" value="${link.substring(pos).substring(1).trim()}"/> + </j:otherwise> + </j:choose> + + <!-- generate the link --> + <j:choose> + <j:when test="${online}" > + <ant:link href="${href}" offline="false" packagelistLoc="${packagelistLoc}" /> + </j:when> + <j:otherwise> + <ant:link href="${href}" offline="true" packagelistLoc="${packagelistLoc}" /> + </j:otherwise> + </j:choose> </j:forEach> - </j:when> - <j:otherwise> - <util:tokenize var="links" delim="," trim="true">${maven.javadoc.offlineLinks}</util:tokenize> - <j:forEach var="link" items="${links}"> - <ant:echo>Linking offline API information from ${link.trim()} ...</ant:echo> + + <ant:classpath> + <ant:path refid="maven.dependency.classpath"/> + <ant:path location="${maven.build.dest}"/> + </ant:classpath> + + <j:if test="${context.getVariable('maven.javadoc.locale') != null}"> + <ant:setProperty name="locale" value="${maven.javadoc.locale}" /> + </j:if> + + <j:if test="${context.getVariable('maven.javadoc.overview') != null}"> + <ant:setProperty name="overview" value="${maven.javadoc.overview}" /> + </j:if> + + <j:if test="${maxMemory != null}"> + <ant:setProperty name="maxmemory" value="${maven.javadoc.maxmemory}" /> + </j:if> + + <j:forEach var="packageGroup" items="${pom.packageGroups}"> + <ant:group title="${packageGroup.title}" packages="${packageGroup.packages}"/> </j:forEach> - </j:otherwise> - </j:choose> - - <j:set var="maxMemory" value="${maven.javadoc.maxmemory}" /> - - <ant:mkdir dir="${maven.build.dir}/javadoc/" /> - <ant:record name="${maven.build.dir}/javadoc/report.txt" action="start" /> - - <ant:javadoc - packagenames="${pom.package}.*" - destdir="${maven.javadoc.destdir}" - author="${maven.javadoc.author}" - public="${maven.javadoc.public}" - package="${maven.javadoc.package}" - private="${maven.javadoc.private}" - version="${maven.javadoc.version}" - use="${maven.javadoc.use}" - windowtitle="${maven.javadoc.windowtitle}" - doctitle="${maven.javadoc.windowtitle}" - bottom="${copyright}" - stylesheetfile="${maven.javadoc.stylesheet}" - additionalparam="${maven.javadoc.additionalparam}" - useexternalfile="${maven.javadoc.useexternalfile}"> - - <ant:fileset dir="${pom.build.sourceDirectory}"> - <ant:include name="**/*.java"/> - <!-- FIXME: This is a bad cut and paste --> - <!-- 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> - <j:forEach var="include" items="${sm.includes}"> - <ant:include name="${include}"/> - </j:forEach> - </j:if> + + <!-- allow custom doclets --> + <j:if test="${context.getVariable('maven.javadoc.doclet') != null}"> + <ant:setProperty name="doclet" value="${maven.javadoc.doclet}" /> + </j:if> + <j:if test="${context.getVariable('maven.javadoc.docletpath') != null}"> + <ant:setProperty name="docletpath" value="${maven.javadoc.docletpath}" /> + </j:if> + + <!-- allow custom tags --> + <util:tokenize var="listOfTags" delim=" ">${maven.javadoc.customtags}</util:tokenize> + <j:forEach var="someTag" items="${listOfTags}"> + <j:set var="nameVar" value="${someTag}.name"/> + <j:set var="name" value="${context.findVariable(nameVar)}"/> + <j:set var="descriptionVar" value="${someTag}.description"/> + <j:set var="description" value="${context.findVariable(descriptionVar)}"/> + <j:set var="enabledVar" value="${someTag}.enabled"/> + <j:set var="enabled" value="${context.findVariable(enabledVar)}"/> + <j:set var="scopeVar" value="${someTag}.scope"/> + <j:set var="scope" value="${context.findVariable(scopeVar)}"/> + <ant:tag name="${name}" description="${description}" + enabled="${enabled}" scope="${scope}"/> </j:forEach> - </ant:fileset> - - <j:if test="${context.getVariable('maven.javadoc.source') != null}"> - <ant:setProperty name="source" value="${maven.javadoc.source}" /> - </j:if> - - <!-- Process/Parse links --> - <!-- This code allows to specify a packagelistLoc even when in online mode --> - <j:forEach var="link" items="${links}"> - <j:set var="pos" value="${link.indexOf('#')}" /> - - <!-- set href and packagelistLoc --> - <j:choose> - <!-- I am bad with jelly, the test is: "pos == -1" --> - <j:when test="${1+pos == 0}"> - <j:set var="href" value="${link.trim()}" /> - <j:set var="packagelistLoc" value="${href}"/> - </j:when> - <j:otherwise> - <j:set var="href" value="${link.substring(0,pos).trim()}"/> - <j:set var="packagelistLoc" value="${link.substring(pos).substring(1).trim()}"/> - </j:otherwise> - </j:choose> - - <!-- generate the link --> - <j:choose> - <j:when test="${online}" > - <ant:link href="${href}" offline="false" packagelistLoc="${packagelistLoc}" /> - </j:when> - <j:otherwise> - <ant:link href="${href}" offline="true" packagelistLoc="${packagelistLoc}" /> - </j:otherwise> - </j:choose> - </j:forEach> - - <ant:classpath> - <ant:path refid="maven.dependency.classpath"/> - <ant:path location="${maven.build.dest}"/> - </ant:classpath> - - <j:if test="${context.getVariable('maven.javadoc.locale') != null}"> - <ant:setProperty name="locale" value="${maven.javadoc.locale}" /> - </j:if> - - <j:if test="${context.getVariable('maven.javadoc.overview') != null}"> - <ant:setProperty name="overview" value="${maven.javadoc.overview}" /> - </j:if> - - <j:if test="${maxMemory != null}"> - <ant:setProperty name="maxmemory" value="${maven.javadoc.maxmemory}" /> - </j:if> - - <j:forEach var="packageGroup" items="${pom.packageGroups}"> - <ant:group title="${packageGroup.title}" packages="${packageGroup.packages}"/> - </j:forEach> - - <!-- allow custom doclets --> - <j:if test="${context.getVariable('maven.javadoc.doclet') != null}"> - <ant:setProperty name="doclet" value="${maven.javadoc.doclet}" /> - </j:if> - <j:if test="${context.getVariable('maven.javadoc.docletpath') != null}"> - <ant:setProperty name="docletpath" value="${maven.javadoc.docletpath}" /> - </j:if> - - <!-- allow custom tags --> - <util:tokenize var="listOfTags" delim=" ">${maven.javadoc.customtags}</util:tokenize> - <j:forEach var="someTag" items="${listOfTags}"> - <j:set var="nameVar" value="${someTag}.name"/> - <j:set var="name" value="${context.findVariable(nameVar)}"/> - <j:set var="descriptionVar" value="${someTag}.description"/> - <j:set var="description" value="${context.findVariable(descriptionVar)}"/> - <j:set var="enabledVar" value="${someTag}.enabled"/> - <j:set var="enabled" value="${context.findVariable(enabledVar)}"/> - <j:set var="scopeVar" value="${someTag}.scope"/> - <j:set var="scope" value="${context.findVariable(scopeVar)}"/> - <ant:tag name="${name}" description="${description}" - enabled="${enabled}" scope="${scope}"/> - </j:forEach> - - <!-- allow taglets --> - <util:tokenize var="listOfTaglets" delim="," trim="true">${maven.javadoc.taglets}</util:tokenize> - <j:set var="tagletPath" value="${context.getVariable('maven.javadoc.tagletpath')}" /> - <j:forEach var="someTaglet" items="${listOfTaglets}"> - <ant:taglet name="${someTaglet}" path="${tagletPath}" /> - </j:forEach> - - </ant:javadoc> - <ant:record name="${maven.build.dir}/javadoc/report.txt" action="stop" /> - - <j:set var="genDocs" value="${maven.gen.docs}" /> - <doc:text-xdoc - title="Javadoc Report" - section="Javadoc Report" - inputFile="${maven.build.dir}/javadoc/report.txt" - output="${genDocs}/javadoc.xml"/> + + <!-- allow taglets --> + <util:tokenize var="listOfTaglets" delim="," trim="true">${maven.javadoc.taglets}</util:tokenize> + <j:set var="tagletPath" value="${context.getVariable('maven.javadoc.tagletpath')}" /> + <j:forEach var="someTaglet" items="${listOfTaglets}"> + <ant:taglet name="${someTaglet}" path="${tagletPath}" /> + </j:forEach> + + </ant:javadoc> + <ant:record name="${maven.build.dir}/javadoc/report.txt" action="stop" /> + + <j:set var="genDocs" value="${maven.gen.docs}" /> + <doc:text-xdoc + title="Javadoc Report" + section="Javadoc Report" + inputFile="${maven.build.dir}/javadoc/report.txt" + output="${genDocs}/javadoc.xml"/> + </j:if> </j:if> </goal>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]