简体   繁体   中英

Ant in Netbeans: overriding run target doesn't work

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.

如我的错误报告的答案所述,解决方案是关闭保存时编译。

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".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM