Apache Ant编写build.XML的自动提示 ANT DTD
发布日期:2022-03-03 10:44:15
浏览次数:4
分类:技术文章
本文共 1722 字,大约阅读时间需要 5 分钟。
大家都知道Eclipse的自动输入或者自动完成的功能是用XML的DTD文件来控制的,但是安装了ANT的插件之后会发现Apache并没有为我们直接提供书写build.xml的DTD文件,可能是由于扩张方面的考虑。在Apache的 FAQ里有提到:
An incomplete DTD can be created by the <antstructure>
task - but this one has a few problems:
- It doesn't know about required attributes. Only manual tweaking of this file can help here.
- It is not complete - if you add new tasks via
<taskdef>
it won't know about it. See by Michel Casabianca for a solution to this problem. Note that the DTD you can download at this page is based on Apache Ant 0.3.1.
- It may even be an invalid DTD. As Ant allows tasks writers to define arbitrary elements, name collisions will happen quite frequently - if your version of Ant contains the optional
<test>
and<junit>
tasks, there are two XML elements namedtest
(the task and the nested child element of<junit>
) with different attribute lists. This problem cannot be solved; DTDs don't give a syntax rich enough to support this.
原文在这里(http://ant.apache.org/faq.html#dtd)
但是Ant的预订标签里面提供了生成DTD的方法。这里需要在%ANT_HOME%的lib目录下面加一个JAR包,
下载地址:http://mirrors.cnnic.cn/apache//commons/net/binaries/commons-net-3.3-bin.zip
现在新建一个build.xml
内容如下:然后使用ANT命令执行这个build.xml文件,在相同路径下就会生成ant_DTD.dtd
现在用Eclipse引用这个DTD就可以实现编写build.xml的时候的自动提示了。 建议把这放在%ANT_HOME%的 etc目录下,以免误删。 Eclipse的设置在:Window--Preference--XML--XML Catalog 点击Add 输入刚才那个生成的DTD文件地址,KEY_TYPE选 public ID , 取一个名字(KEY),OK 现在按下alt+/ 就可以在有提示内容的地方弹出提示了 当然,如果想在输入的时候就直接弹出,要设置:Window--Preference--XML--XML File--Editor 在Content asist里,勾上 Automatically make suggestion, 然后在 Prompt when these characters are inserted 里面改成 <=:abcdefghijklmnopqrstuvwxyz ${ OK!当然这样做会是Eclipse的速度变慢,喜忧参半。转载地址:http://www.cnblogs.com/lzsu1989/archive/2011/07/26/2117718.html
转载地址:https://blog.csdn.net/yangjiegreat/article/details/44785603 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
路过,博主的博客真漂亮。。
[***.116.15.85]2024年04月07日 12时25分46秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
01 计算机视觉-opencv图像基本操作
2019-04-26
02 计算机视觉-opencv阈值与滤波处理
2019-04-26
03 计算机视觉-opencv图像形态学处理
2019-04-26
04计算机视觉-opencv图像梯度处理
2019-04-26
05计算机视觉-opencv边缘检测
2019-04-26
07 计算机视觉-opencv模板匹配
2019-04-26
Word2vec与logging模块_完整代码_CodingPark编程公园
2019-04-26
Auto-Encoder&VAE_完整代码_CodingPark编程公园
2019-04-26
Debug讲解_CodingPark编程公园
2019-04-26
命名实体识别_利用CRF_CodingPark编程公园
2019-04-26
Pycharm使用-取消pytest的办法_CodingPark编程公园
2019-04-26
OpenCV图像处理基础_CodingPark编程公园
2019-04-26
生成个性二维码_CodingPark编程公园
2019-04-26
读txt文件报错_CodingPark编程公园
2019-04-26
文件读&写_Python_CodingPark编程公园
2019-04-26
list与str的转换&list嵌套问题_CodingPark编程公园
2019-04-26