I have a patch for macrodef which allows macrodef to have (nearly) arbitrary xml fragments:
<macrodef name="thecommonlinks"> <sequential> <!-- This part is very common : Start --> <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" packagelistLoc="javadoc/j2se-1.5.0"/> <link offline="true" href="http://java.sun.com/javaee/5/docs/api/" packagelistLoc="javadoc/javaee-5"/> <link href="http://lab.ourserver.com/javadoc/common/"/> <link href="http://lab.ourserver.com/javadoc/dist/"/> <link href="http://lab.ourserver.com/javadoc/ejb/"/> <link href="http://lab.ourserver.com/javadoc/web/"/> </sequential> </macrodef> <javadoc destdir="${javadoc.dir}/common" classpathref="path.combined" windowtitle="SOM Common API Doc" encoding="UTF-8" charset="UTF-8" access="private"> <thecommonlinks/> <fileset dir="${somCommon.dir}/src"> <include name="**/*.java"/> </fileset> </javadoc> (https://issues.apache.org/bugzilla/show_bug.cgi?id=40678) I have some issues with it - namely the reporting of errors - the code currently cannot see the full ant script stack trace to report errors. In the meantime, you should use <presetdef> <presetdef name="myjavadoc"> <javadoc encoding="UTF-8" charset="UTF-8" access="private"> <!-- This part is very common : Start --> <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" packagelistLoc="javadoc/j2se-1.5.0"/> <link offline="true" href="http://java.sun.com/javaee/5/docs/api/" packagelistLoc="javadoc/javaee-5"/> <link href="http://lab.ourserver.com/javadoc/common/"/> <link href="http://lab.ourserver.com/javadoc/dist/"/> <link href="http://lab.ourserver.com/javadoc/ejb/"/> <link href="http://lab.ourserver.com/javadoc/web/"/> <link href="http://lab.ourserver.com/javadoc/downloadClient/"/> <!-- This part is very common : End --> </javadoc> </presetdef> <myjavadoc destdir="${javadoc.dir}/common" classpathref="path.combined" windowtitle="SOM Common API Doc"> <fileset dir="${somCommon.dir}/src"> <include name="**/*.java"/> </fileset> </myjavadoc> Peter On Fri, Mar 14, 2008 at 10:28 AM, Kent Larsson <[EMAIL PROTECTED]> wrote: > Hi, > > In our Ant script to build Javadoc we have lots of <link ...>'s inside > our <javadoc ...>'s where the <link ...>'s are duplicated into most of > our <javadoc ...>'s. We would like to reference these so we don't have > the same lines of code in lots of places in the build script. We have > tried googling and reading the Ant and Javadoc manuals without success. > > /* Start of example Javadoc Ant snippet */ > <javadoc destdir="${javadoc.dir}/common" > classpathref="path.combined" > windowtitle="SOM Common API Doc" > encoding="UTF-8" > charset="UTF-8" > access="private"> > <!-- This part is very common : Start --> > <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" > packagelistLoc="javadoc/j2se-1.5.0"/> > <link offline="true" href="http://java.sun.com/javaee/5/docs/api/" > packagelistLoc="javadoc/javaee-5"/> > <link href="http://lab.ourserver.com/javadoc/common/"/> > <link href="http://lab.ourserver.com/javadoc/dist/"/> > <link href="http://lab.ourserver.com/javadoc/ejb/"/> > <link href="http://lab.ourserver.com/javadoc/web/"/> > <link href="http://lab.ourserver.com/javadoc/downloadClient/"/> > <!-- This part is very common : End --> > <fileset dir="${somCommon.dir}/src"> > <include name="**/*.java"/> > </fileset> > </javadoc> > /* End of example Javadoc Ant snippet */ > > Is there a way to bundle the links so they may be referenced? Something > similar to: > > /* Start of example pseudo-code Javadoc Ant snippet */ > <linkbundle name="thecommonlinks"> > <!-- This part is very common : Start --> > <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" > packagelistLoc="javadoc/j2se-1.5.0"/> > <link offline="true" href="http://java.sun.com/javaee/5/docs/api/" > packagelistLoc="javadoc/javaee-5"/> > <link href="http://lab.ourserver.com/javadoc/common/"/> > <link href="http://lab.ourserver.com/javadoc/dist/"/> > <link href="http://lab.ourserver.com/javadoc/ejb/"/> > <link href="http://lab.ourserver.com/javadoc/web/"/> > <!-- This part is very common : End --> > </linkbudle> > > <javadoc destdir="${javadoc.dir}/common" > classpathref="path.combined" > windowtitle="SOM Common API Doc" > encoding="UTF-8" > charset="UTF-8" > access="private"> > <linkbudlereference name="thecommonlinks"/> > <fileset dir="${somCommon.dir}/src"> > <include name="**/*.java"/> > </fileset> > </javadoc> > /* End of example pseudo-code Javadoc Ant snippet */ > > As we have 7-8 <javadoc> tags (to build individual javadocs when we > don't want to build them all) it would be nice and clean to reference > common <link> tags in some way. > > Thanks for reading! > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]