1

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.

java.is.for.desktop
  • 10,748
  • 12
  • 69
  • 103

2 Answers2

1

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

java.is.for.desktop
  • 10,748
  • 12
  • 69
  • 103
  • "Compile on Save is a project-specific option. It can be enabled/disabled in project properties, on the Compilation tab." http://wiki.netbeans.org/FaqCompileOnSave#How_to_turn_it_on.2Foff – CrazyPyro Mar 21 '14 at 15:43
0

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

PeterMmm
  • 24,152
  • 13
  • 73
  • 111
  • Hmm, F6 is "run main project" only when there IS a main project. In my case when no main project is selected, it says "run Test123" (the current project). *What F6 does, is running the project using ant.* I think it is a bug (the fact that custom overrides are not considered), I will report it. – java.is.for.desktop Feb 28 '11 at 21:38