Ant in Netbeans: overriding run target doesn't work

送分小仙女□ 提交于 2019-12-24 06:58:22

问题


I am trying to override the "run" target in a Netbeans project. What I'm doing is editing the file build.xml:

<project name="Test123" default="default" basedir=".">
    <import file="nbproject/build-impl.xml"/>

    <target depends="init,compile" name="run">
        <echo>AAAAAAAAAAAAAAAAAAAAAA</echo>
    </target>
    <target depends="init,compile-single" name="run-single">
        <echo>AAAAAAAAAAAAAAAAAAAAAA</echo>
    </target>
</project>

I tried to override both "run" and "run-single", but both things doesn't change anything. When pressing F6, the project's Main class is executed as before. The test message (AAA...) is not printed.

EDIT:
Created a bug report for Netbeans.


回答1:


The solutions is, as mentioned in the answer to my bug report, to turn off compile-on-save.




回答2:


That seems to be correct. Do not use F6, try to run the "run" target from the context menu on the build.xml file. That should work.

I think the default key binding for F6 is "Run Main Project" and that does not the same as "run".



来源:https://stackoverflow.com/questions/5147188/ant-in-netbeans-overriding-run-target-doesnt-work

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