How to make custom ant task?

浪子不回头ぞ 提交于 2019-12-24 05:07:05

问题


I am learning a new upcoming language known as Visage. This language is almost the same as the Open Source JavaFX 1.3 . My problem is that Visage has its own compiler and to compile a visage file I need to use 'visagec filename.visage' and the run the class file generated I need to use 'visage filename'. I want this task to be automated using the ant script. I also need to include some jar files in the classpath while doing so. Can someone please let me know how to write a custom ant script for the above language. I have already added VISAGE_HOME in my environment variables.


回答1:


Maybe you can achieve what you need using an exec task - where you execute your compiler using a system command? The apply task might also be useful.

If you do implement your own compiler task, I would suggest looking at the source code of an existing Ant compilation task, e.g. org.apache.tools.ant.taskdefs.Javac.

If you do implement your own task, then the references suggested in AlexK's comment are required reading. I'll copy them here:

  • Writing Your Own Task
  • Tutorial: Writing Tasks



回答2:


The resources mentioned by Alex were really useful and I was amazed to see how easy it was to make a little changes here and there and get through it.The links that helped me were:-

  • ant.apache.org/manual/Tasks/scriptdef.htm
  • ant.apache.org/manual/develop.html
  • ant.apache.org/manual/tutorial-writing-tasks.html


来源:https://stackoverflow.com/questions/8121846/how-to-make-custom-ant-task

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!