Tuesday, March 20, 2007

Generate Documents With Gridsphere Portlet -- A Bug in build.xml

I wanted to create document for my portlet calledtestportlet created in GridsphereframeworkWhen I run


ant docs


I got errors:


BUILDFAILED
/path/to/gridsphere-2.1.5/projects/testportlet/build.xml:256: No sou rce filesand no packages have been specified.



In the build.xml file the"ant docs" is defined as:

....
<target name="docs" depends="javadocs"description="Create projectdocumentation"/> <!--===================================================================--> <!-- Creates allthe APIdocumentation --> <!--===================================================================--> <targetname="javadocs" depends="setenv" description="CreateJavadocs"> <echo>CreatingJavadocs</echo> <delete quiet="true"dir="${build.javadoc}"/> <mkdirdir="${build.javadoc}"/> <javadocsourcepath="src" classpathref="classpath" destdir="${build.javadoc}" author="true" version="true" splitindex="true" use="true" maxmemory="180m" windowtitle="${project.title}" doctitle="${project.api}"> <!--bottom="Copyright &#169; 2002,2003 GridLab Project. All RightsReserved."> --> </javadoc> </target>
...

I am using Java 1.5 and Apach Ant 1.6. Look like it is the issue of Java 1.5,the sourcepath is ignored even though Irun "javadoc" command from a separatepackage independent of Gridsphere framework. I modified a little bit of thebuild.xml file and now it is workingwell:

1. First remove attribute sourcepath="src"
2. Add "<fileset dir="src" />" to <javadoc> element.

The modified file should look like:

.... <target name="docs" depends="javadocs"description="Create projectdocumentation"/> <!--===================================================================--> <!-- Creates allthe API documentation --> <!--===================================================================--> <targetname="javadocs" depends="setenv" description="CreateJavadocs"> <echo>CreatingJavadocs</echo> <delete quiet="true"dir="${build.javadoc}"/> <mkdirdir="${build.javadoc}"/> <javadocsourcepath="src" classpathref="classpath" destdir="${build.javadoc}" author="true" version="true" splitindex="true" use="true" maxmemory="180m" windowtitle="${project.title}" doctitle="${project.api}"> <filesetdir="src" /> <!--bottom="Copyright &#169; 2002,2003 GridLab Project. All RightsReserved."> --> </javadoc> </target> ...


Save file and run "ant docs" or"ant javadocs", the document files aregenerated in/path/to/gridsphere-2.1.5/projects/testportlet/build/docs/javadocs/.

Commentary:

Some one had mentioned that the combination of ant 1.6 and Java 1.5 wouldigmore attribute "sourcepath" in thebuild file, but I think it is the problem of Java 1.5. Do Gridspherepeople notice that? Anyway, it is still very nice to be able to generatedocuments for portlets from within Gridsphere framework environment if we do alittle bit extra work.

No comments: