__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
Hi,

I'm working with Ant1.5 (according to $ANT_HOME/welcome.html).

I'm trying to extend the tag set of ant.

I've never done it before.

The tag I want to add is <vizant> which corresponds
to a utility for building visualization of build.xml files.

You will see a nice demo here:
http://vizant.sourceforge.net/examples.html

Based on my reading I need to do two things:

1. Find the appropriate .jar file for the <vizant> tag and add the .jar file to 
   $ANT_HOME/lib.

2. Add an appropriate <taskdef> tag to the build file.


So...

I built a AntViz.jar file from an AntViz download.

Here is my copy of AntViz:

[EMAIL PROTECTED] dist]# cd /home/dan/AntViz
[EMAIL PROTECTED] AntViz]# ls
./                  classes/             README.txt
../                 dist/                src/
actions.xml         docbook-wrapper.xsl  toc.xml
antvizhelp.xml      dockables.xml        users-guide2002-0803.xml
AntViz.props        index.html           users-guide2002-0803.xsl
build/              lib/                 users-guide.xml
build2003-0803.xml  license_dom4j.html   users-guide.xsl
build.xml           LICENSE_jgraph       word-index.xml
changes.txt         LICENSE.txt
[EMAIL PROTECTED] AntViz]# 


I used ant to create the AntViz.jar file:

[EMAIL PROTECTED] AntViz]# ant dist
Buildfile: build.xml

compile:
   [delete] Deleting directory /home/dan/AntViz/classes
    [mkdir] Created dir: /home/dan/AntViz/classes
    [javac] Compiling 28 source files to /home/dan/AntViz/classes
    [javac] /home/dan/AntViz/src/antviz/AntViz.java:863: warning: getFile() in 
org.gjt.sp.jedit.Buffer has been deprecated
    [javac]                 antBuildFileDir = currentBuffer.getFile().getParent();
    [javac]                                                ^
    [javac] /home/dan/AntViz/src/antviz/debugger/AntPrintStream.java:94: warning: 
print(java.awt.Color,java.lang.String) in console.Console has been deprecated
    [javac]             console.print(console.getInfoColor(), line);
    [javac]                    ^
    [javac] /home/dan/AntViz/src/antviz/debugger/AntPrintStream.java:96: warning: 
print(java.awt.Color,java.lang.String) in console.Console has been deprecated
    [javac]             console.print(console.getErrorColor(), line);
    [javac]                    ^
    [javac] /home/dan/AntViz/src/antviz/debugger/AntPrintStream.java:98: warning: 
print(java.awt.Color,java.lang.String) in console.Console has been deprecated
    [javac]             console.print(null, line);
    [javac]                    ^
    [javac] 4 warnings

dist:
      [jar] Building jar: /home/dan/AntViz/dist/AntViz.jar

BUILD SUCCESSFUL
Total time: 5 seconds
[EMAIL PROTECTED] AntViz]# 



I inspected the resulting .jar file:

[EMAIL PROTECTED] AntViz]# jar tvf /home/dan/AntViz/dist/AntViz.jar
     0 Tue Sep 30 07:47:22 PDT 2003 META-INF/
   104 Tue Sep 30 07:47:20 PDT 2003 META-INF/MANIFEST.MF
     0 Tue Sep 30 07:47:22 PDT 2003 antviz/
   372 Tue Sep 30 07:47:20 PDT 2003 antviz/AntGraphPopupMenu.class
  1266 Tue Sep 30 07:47:20 PDT 2003 antviz/AntViz$1.class
   516 Tue Sep 30 07:47:20 PDT 2003 antviz/AntViz$2.class
  1066 Tue Sep 30 07:47:20 PDT 2003 antviz/AntViz$StreamGobbler.class
 18000 Tue Sep 30 07:47:20 PDT 2003 antviz/AntViz.class
   142 Tue Sep 30 07:47:20 PDT 2003 antviz/AntVizActions.class
     0 Tue Sep 30 07:47:22 PDT 2003 antviz/debugger/
  1896 Tue Sep 30 07:47:20 PDT 2003 antviz/debugger/AntPrintStream.class
  4519 Tue Sep 30 07:47:22 PDT 2003 antviz/debugger/DebugGobbler.class
   893 Tue Sep 30 07:47:22 PDT 2003 antviz/debugger/DebugReader.class
   171 Tue Sep 30 07:47:22 PDT 2003 antviz/debugger/StopDebugException.class
  4625 Tue Sep 30 07:47:22 PDT 2003 antviz/debugger/AntListener.class
   730 Tue Sep 30 07:47:22 PDT 2003 antviz/debugger/BufferWait.class
    99 Tue Sep 30 07:47:22 PDT 2003 antviz/debugger/Command.class
  2230 Tue Sep 30 07:47:22 PDT 2003 antviz/debugger/DebugSelectionCommand.class
   613 Tue Sep 30 07:47:22 PDT 2003 antviz/debugger/DebugTargetChangeListener.class
   540 Tue Sep 30 07:47:22 PDT 2003 antviz/AntVizToolPanel$1.class
   538 Tue Sep 30 07:47:22 PDT 2003 antviz/AntVizToolPanel$2.class
   537 Tue Sep 30 07:47:22 PDT 2003 antviz/AntVizToolPanel$3.class
   537 Tue Sep 30 07:47:22 PDT 2003 antviz/AntVizToolPanel$4.class
  3327 Tue Sep 30 07:47:22 PDT 2003 antviz/AntVizToolPanel.class
  1790 Tue Sep 30 07:47:22 PDT 2003 antviz/JNaviBar.class
     0 Tue Sep 30 07:47:22 PDT 2003 antviz/graph/
  1795 Tue Sep 30 07:47:22 PDT 2003 antviz/graph/AntGraph.class
   474 Tue Sep 30 07:47:22 PDT 2003 antviz/graph/DependencyNodeCell.class
   407 Tue Sep 30 07:47:22 PDT 2003 antviz/graph/DependencyNodeRenderer.class
   581 Tue Sep 30 07:47:22 PDT 2003 antviz/graph/DependencyNodeView.class
  2597 Tue Sep 30 07:47:22 PDT 2003 antviz/DependencyNode.class
  1770 Tue Sep 30 07:47:22 PDT 2003 antviz/NaviBarMouseListener.class
  3131 Tue Sep 30 07:47:22 PDT 2003 antviz/AntVizMouseListener.class
  2667 Tue Sep 30 07:47:22 PDT 2003 antviz/AntVizOptionPane.class
   852 Tue Sep 30 07:47:22 PDT 2003 antviz/AntVizPlugin.class
  1084 Tue Sep 30 07:47:22 PDT 2003 antviz/PopupActionListener.class
  1425 Tue Sep 30 07:47:22 PDT 2003 antviz/SelectionCommand.class
     0 Tue Sep 30 07:47:22 PDT 2003 antviz/util/
  1440 Tue Sep 30 07:47:22 PDT 2003 antviz/util/FontUtil.class
  2773 Tue Sep 30 07:47:22 PDT 2003 antviz/util/SaxHandler.class
   158 Tue Sep 30 07:47:22 PDT 2003 antviz/util/TextConstans.class
   675 Sat Aug 03 14:06:34 PDT 2002 actions.xml
  1766 Sat Aug 03 14:06:34 PDT 2002 AntViz.props
   214 Sat Aug 03 14:06:34 PDT 2002 dockables.xml
[EMAIL PROTECTED] AntViz]# 





I copied it to $ANT_HOME/lib:

[EMAIL PROTECTED] AntViz]# cp -p /home/dan/AntViz/dist/AntViz.jar $ANT_HOME/lib



Here is a view of my $ANT_HOME/lib:

[EMAIL PROTECTED] AntViz]# ls -la $ANT_HOME/lib
total 9404
drwxr-xr-x    2 root     root         4096 Sep 29 22:45 ./
drwxr-xr-x    6 root     root         4096 Aug 22 11:20 ../
-rw-r--r--    1 root     root        76933 May  5 21:57 AntFarm.jar
-rw-r--r--    1 root     root       735451 May 30 05:53 ant.jar
-rw-------    1 root     root       654735 Mar 25  2003 ant-optional.jar
-rw-r--r--    1 root     root        41855 Sep 30 07:47 AntViz.jar
-rw-rw-r--    1 root     root        56243 Aug  4  2002 AntVizPlugin.jar
-rw-r--r--    1 root     root        28054 May  5 22:03 CommonControls.jar
-rw-rw-r--    1 root     root       144642 Aug  7 16:07 Console.jar
-rw-rw-rw-    1 root     root       456914 Aug  3  2002 dom4j.jar
-rw-rw-r--    1 root     root        42839 May 30 16:59 ErrorList.jar
-rw-rw-rw-    1 root     root       137141 Aug  3  2002 jgraph.jar
-rw-r--r--    1 root     root         2641 Sep 29 18:58 LatestVersion.jar
-rw-r--r--    1 root     root       424231 May 30 05:54 optional.jar
-rw-r--r--    1 root     root        10627 Sep 29 18:58 QuickNotepad.jar
-rw-rw-r--    1 root     root        35252 Jul  7 15:21 SideKick.jar
-rw-r--r--    1 root     root      5092901 Jul 31 13:29 tools.jar
-rw-r--r--    1 root     root       927669 Jul 31 10:13 xercesImpl.jar
-rw-r--r--    1 root     root       121686 Jul 31 10:13 xercesSamples.jar
-rw-r--r--    1 root     root       123705 Jul 31 10:13 xml-apis.jar
-rw-r--r--    1 root     root        51861 Jul  7 15:25 xml-commons-resolver.jar
-rw-rw-r--    1 root     root       223265 Jul  7 15:25 XML.jar
-rw-r--r--    1 root     root       123705 Jul 31 10:13 xmlParserAPIs.jar
[EMAIL PROTECTED] AntViz]# 

So I assume that I'm almost done.

All I need to do is add an appropriate <taskdef> tag to the build.xml.

I created a simple build.xml file:

<?xml version="1.0"?>
<!-- A simple build.xml file -->
<project name="bikle build.xml 01" default="main" basedir=".">

    <taskdef name="vizant" classname="antviz.AntViz"/>
      <classpath>
        <path location="/sun1/jwsdp-1.2/apache-ant/lib/AntViz.jar"/>
      </classpath>
    </taskdef>

    <target name="main">
      <vizant antfile="build.xml" outfile="build.dot"/>
      <exec executable="dot" ><arg line="-Tpng build.dot -o build.png"/></exec>
    </target> 
</project>

When I run ant I see this:


[EMAIL PROTECTED] ant]# ant
Buildfile: build.xml

BUILD FAILED
file:/home/dan/ptdir2003-0731/TThier/J2EE/ep/ant/build.xml:6: taskdef class 
antviz.AntViz cannot be found

Total time: 1 second
[EMAIL PROTECTED] ant]# 



I then checked a few things:

[EMAIL PROTECTED] ant]# env|grep ANT
ANT_HOME=/sun1/jwsdp-1.2/apache-ant
[EMAIL PROTECTED] ant]# 

That looks okay.





[EMAIL PROTECTED] ant]# jar tf /sun1/jwsdp-1.2/apache-ant/lib/AntViz.jar
META-INF/
META-INF/MANIFEST.MF
antviz/
antviz/AntGraphPopupMenu.class
antviz/AntViz$1.class
antviz/AntViz$2.class
antviz/AntViz$StreamGobbler.class
antviz/AntViz.class
antviz/AntVizActions.class
antviz/debugger/
antviz/debugger/AntPrintStream.class
antviz/debugger/DebugGobbler.class
antviz/debugger/DebugReader.class
antviz/debugger/StopDebugException.class
antviz/debugger/AntListener.class
antviz/debugger/BufferWait.class
antviz/debugger/Command.class
antviz/debugger/DebugSelectionCommand.class
antviz/debugger/DebugTargetChangeListener.class
antviz/AntVizToolPanel$1.class
antviz/AntVizToolPanel$2.class
antviz/AntVizToolPanel$3.class
antviz/AntVizToolPanel$4.class
antviz/AntVizToolPanel.class
antviz/JNaviBar.class
antviz/graph/
antviz/graph/AntGraph.class
antviz/graph/DependencyNodeCell.class
antviz/graph/DependencyNodeRenderer.class
antviz/graph/DependencyNodeView.class
antviz/DependencyNode.class
antviz/NaviBarMouseListener.class
antviz/AntVizMouseListener.class
antviz/AntVizOptionPane.class
antviz/AntVizPlugin.class
antviz/PopupActionListener.class
antviz/SelectionCommand.class
antviz/util/
antviz/util/FontUtil.class
antviz/util/SaxHandler.class
antviz/util/TextConstans.class
actions.xml
AntViz.props
dockables.xml
[EMAIL PROTECTED] ant]# 

That looks okay.




[EMAIL PROTECTED] ant]# cat /home/dan/ptdir2003-0731/TThier/J2EE/ep/ant/build.xml
<?xml version="1.0"?>

<!-- A simple build.xml file -->
<project name="bikle build.xml 01" default="main" basedir=".">

    <taskdef name="vizant" classname="antviz.AntViz">
      <classpath>
        <path location="/sun1/jwsdp-1.2/apache-ant/lib/AntViz.jar"/>
      </classpath>
    </taskdef>

    <target name="main">
      <vizant antfile="build.xml" outfile="build.dot"/>
      <exec executable="dot" ><arg line="-Tpng build.dot -o build.png"/></exec>
    </target> 

</project>


That looks okay.

I wonder why ant cannot find "antviz.AntViz" inside of 
/sun1/jwsdp-1.2/apache-ant/lib/AntViz.jar
??






Also I tried putting AntViz.jar in my CWD and also changing the 
syntax of the <taskdef> tag:

[EMAIL PROTECTED] ant]# cat build.xml
<?xml version="1.0"?>

<!-- A simple build.xml file -->
<project name="bikle build.xml 01" default="main" basedir=".">

    <taskdef name="vizant" classname="antviz.AntViz" classpath="AntViz.jar"/>

    <target name="main">
      <vizant antfile="build.xml" outfile="build.dot"/>
      <exec executable="dot" ><arg line="-Tpng build.dot -o build.png"/></exec>
    </target> 

</project>
[EMAIL PROTECTED] ant]# 
[EMAIL PROTECTED] ant]# 
[EMAIL PROTECTED] ant]# ant
Buildfile: build.xml

BUILD FAILED
file:/home/dan/ptdir2003-0731/TThier/J2EE/ep/ant/build.xml:6: taskdef class 
antviz.AntViz cannot be found

Total time: 1 second
[EMAIL PROTECTED] ant]# 



Also I tried changing the name of the <vizant> tag to <AntViz> so that it would match 
the class name:

[EMAIL PROTECTED] ant]# cat build.xml
<?xml version="1.0"?>

<!-- A simple build.xml file -->
<project name="bikle build.xml 01" default="main" basedir=".">

    <taskdef name="AntViz" classname="antviz.AntViz" classpath="AntViz.jar"/>

    <target name="main">
      <AntViz antfile="build.xml" outfile="build.dot"/>
      <exec executable="dot" ><arg line="-Tpng build.dot -o build.png"/></exec>
    </target> 

</project>
[EMAIL PROTECTED] ant]# ant
Buildfile: build.xml

BUILD FAILED
file:/home/dan/ptdir2003-0731/TThier/J2EE/ep/ant/build.xml:6: taskdef class 
antviz.AntViz cannot be found

Total time: 1 second
[EMAIL PROTECTED] ant]# 




If you have made <vizant> work in your build.xml files, and have any tips for 
me, please send me clues.

Thanks,

-Dan
[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to