Ant任务依赖图形化工具-阿里云开发者社区

开发者社区> 唐玄奘> 正文

Ant任务依赖图形化工具

简介:
+关注继续查看

When inheriting an Ant build file to maintain, it is useful to get a feel for the flow and structure. Sketching the dependencies between targets is a useful way to do this. While it is time consuming to do so by hand, there are a number of tools to help.

I tried three different tools to generate the output. All of them generate a .dot file which needs to be run through the Graphviz tool to be converted to a useful format. Graphviz can covert to all image formats among many others. Each tool is described below with an example of how to call it. I've also included two sample images: from our build script to Pick Winners in the weekly book/software promotion and a contrived example designed to show how antCall and forEach work.

  1. Ant2Dot - Ant2Dot is an XSLT file that converts your Ant build file into a .dot file. Each target becomes a rectangle and dependencies between targets are shown. The instructions for using it are a bit old and only apply to Java 1.3 and 1.4. They don't work on Java 5/6 without modification. The website lists a "to do" for adding support for Ant 1.6's import and subant features. Similarly, 1.7 features aren't supported yet. Ant2Dot is good for simple build files, but doesn't scale up to handle use advanced features. Running was as simple as downloading a stylesheet and running the command:
    C:\j2re1.4.2_03\bin\java org.apache.xalan.xslt.Process
    -IN build.xml -XSL ant2dot.xsl -OUT build.dot
    Output of JavaRanch's book promotion pick a winner dependency structure and a contrived sample:
  2. Vizant - Vizant is a Java library that creates a .dot file by using a SAX parser on your Ant build file. Each target becomes an oval and dependencies between targets are shown. Vizant supports antcalls and allows you to drill down to generate only part of the build tree. You can also drill down to show part of your build tree. Vizant was easy to use. I wanted the dependency ordering so continued looking for a library to meet my needs. In order to run Vizant, you need to download a jar containing the source and build it using Ant. They provide the build.xml to do so. Since this is a library for Ant documentation, it is reasonable to assume people know how to run Ant. You also call it through a simple Ant build file:
    <?xml version="1.0"?>
    <project name="Vizant" basedir="." default="vizant">
    <taskdef name="vizant"
    classname="net.sourceforge.vizant.Vizant"
    classpath="build/vizant.jar" />

    <target name="vizant">
    <vizant antfile="build.xml" outfile="build.dot" uniqueref="true" />
    </target>

    </project>
    Output of JavaRanch's book promotion pick a winner dependency structure and a contrived sample:
  3. Grand - Grand is also a Java library that creates a .dot file. It takes a different approach and actually creates the Ant directory structure using Ant's Java libraries. It can support anything in your classpath including ant-contrib and Ant 1.6's import feature. The logic doesn't capture the subtleties of Ant-Contrib like the forEach loop though. The graph is a bit more detailed. The default target is a yellow hexagon. Targets with a description are marked in blue so you can show entry points. The remaining targets are shown as ovals. You can also drill down to show part of your build tree. You can use a Grand UI tool instead of the dot file, but I wasn't able to get the UI. Like Ant2Dot, dependencies are numbered. Grand was as easy to use as Vizant. They provide you with a jar for download. You call it through a simple Ant build file adding any other jars used to the classpath:
    <?xml version="1.0"?>
    <project name="Grand" basedir="." default="grand">

    <typedef resource="net/ggtools/grand/antlib.xml" classpath="grand.jar" />

    <target name="grand">
    <grand output="grand-build.dot" buildfile="build.xml" />
    </target>

    </project>
    Output of JavaRanch's book promotion pick a winner dependency structure and a contrived sample:
Comparison of visualization tools
Tool Shows dependency ordering Flags default target Flags main targets
Ant2Dot Yes Yes No
Vizant No No No
Grand Yes Yes Yes

本文转自博客园zhyiwww 的博客,原文链接:http://www.blogjava.net/zhyiwww/,如需转载请自行联系原博主。

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
C#软件开发实例.私人订制自己的屏幕截图工具(十)在截图中包含鼠标指针形状
在写一此帮助说明类的文档时,截取的图片如果还有鼠标的指针形状,看起来就更直观更友好一些。接下来就讲一下如何在截图中包含鼠标指针形状。 上一篇:C#软件开发实例.私人订制自己的屏幕截图工具(九)使用自定义光标,QQ截图时的光标 添加结构CURSORINFO: [StructLayout(LayoutKind.
807 0
Redis图形监控工具--RedisLive
一、简介         RedisLive是一款用Python编写的Redis图形监控工具,其源码在这里,英文文档在这里。RedisLive的原理很简单,就是通过监控脚本来利用Redis提供的MONITOR命令从被监控Redis实例中获取数据并存储到Redis的监控实例中来做数据分析。
1595 0
阿里云服务器如何登录?阿里云服务器的三种登录方法
购买阿里云ECS云服务器后如何登录?场景不同,阿里云优惠总结大概有三种登录方式: 登录到ECS云服务器控制台 在ECS云服务器控制台用户可以更改密码、更换系.
12295 0
PyQt5 图形界面 - Qt Designer独立安装包,仅需30M!python图像化界面绘制工具
PyQt5 图形界面 - Qt Designer独立安装包,仅需30M!python图像化界面绘制工具
8 0
UAVStack JVM监控分析工具:图形化展示采集及分析监控数据
UAVStack推出的JVM监控分析工具提供基于页面的展现方式,以图形化的方式展示采集到的监控数据;同时提供JVM基本参数获取、内存dump、线程分析、内存分配采样和热点方法分析等功能。
6152 0
+关注
641
文章
0
问答
文章排行榜
最热
最新
相关电子书
更多
《2021云上架构与运维峰会演讲合集》
立即下载
《零基础CSS入门教程》
立即下载
《零基础HTML入门教程》
立即下载