You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Kent Larsson <Ke...@tpb.se> on 2008/03/14 11:28:03 UTC

Ant script for building Javadoc, is there a way to bundle common tags?

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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant script for building Javadoc, is there a way to bundle common tags?

Posted by Dominique Devienne <dd...@gmail.com>.
On Fri, Mar 14, 2008 at 6:17 AM, Peter Reilly
<pe...@gmail.com> wrote:
> 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>

This is great Peter, except for the name maybe. Would it be possible
to keep <macrodef> for tasks and have a separate <fragmentdef> for XML
fragments to be used inside tasks or types? <fragmentdef> then can get
rid of the nested <sequential> and doesn't accept <attribute> and
<element>?!?!

Also, if the fragment contains ${prop} and @{prop}, which context is
used to replace these (if at all), the declaration point or the use
point? --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant script for building Javadoc, is there a way to bundle common tags?

Posted by Peter Reilly <pe...@gmail.com>.
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 <Ke...@tpb.se> 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: user-unsubscribe@ant.apache.org
>  For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant script for building Javadoc, is there a way to bundle common tags?

Posted by Steve Loughran <st...@apache.org>.
Kent Larsson 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.
> 

> 
> 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.

<presetdef> is always your first port of call in these situations

-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE Ant script for building Javadoc, is there a way to bundle common tags?

Posted by ni...@steria.com.
Hi,

Why not using XML entities, which is not specific to Ant but simply XML ?

Nico

"Kent Larsson" <Ke...@tpb.se> wrote on 14/03/2008 11:28:03:

> 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: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 







Ce message est à l'attention exclusive des destinataires désignés. Il peut 
contenir des informations confidentielles. Si vous n'êtes pas destinataire 
du message, merci d'en avertir immédiatement l'expéditeur et de détruire 
ce message. Le contenu de ce message ne pourrait engager la responsabilité 
de Steria que s'il a été émis par une personne dûment habilitée agissant 
dans le strict cadre de ses fonctions et à des fins non étrangères à ses 
attributions. Bien que les meilleurs efforts soient faits pour maintenir 
cette transmission exempte de tout virus, l'expéditeur ne donne aucune 
garantie à cet égard et sa responsabilité ne saurait être engagée pour 
tout dommage résultant d'un virus transmis.


This message is intended exclusively for the designated addressee. It may 
contain confidential material. If you are not the correct addressee, 
please notify the sender immediately and destroy the message. The content 
of this message will engage the responsibility of Steria only if it has 
been sent by an authorized person acting in the strict scope of his 
functions and for purposes that are related to his competence. Although 
reasonable efforts have been made to keep this transmission free from 
viruses, the sender will not be liable for damages caused by a transmitted 
virus.