shaanyes
shaanyes

Reputation: 51

Netbeans Ant build.compiler.emacs

The default ant settings in Netbeans has the property build.compiler.emacs set to true. What does this mean? The ant documentation just says

Enable emacs-compatible error messages.

I understand emacs is an editor, though I have not used it. What is the effect of setting this property to true or false?

Upvotes: 3

Views: 1361

Answers (1)

Seki
Seki

Reputation: 11465

You might not have noticed that that part of the ant documentation describing the javac task is in the "Jikes notes". It's a setting that modifies the result message format of a compilation while using the jikes compiler in a way that when ant is invoked by the Emacs editor (e.g. while using the JDEE environment), the editor can parse the result messages and jump at correct positions in the files related to the messages.

It is indeed a bit weird that NB includes such a setting for a compiler that is not the standard one and seems abandoned for almost a decade.

Given the following ant build.xml file

<project name="mini" basedir="." default="compile">
  <property name="build.compiler.emacs" value="off"/>
  <property name="build.compiler" value="jikes"/><!-- invoke jikes instead of javac-->
  <target name="compile">
    <javac srcdir="." destdir="" classpath="." includeantruntime="false">
    </javac>
  </target>
</project>

The compilation of a simple class comporting a syntax error gives that output:

Buildfile: /Users/seb/projets/java/ant/build.xml

compile:
    [javac] Compiling 1 source file to /Users/seb/projets/java/ant
    [javac] 
    [javac] Found 1 semantic error compiling "Hello.java":
    [javac] 
    [javac]      5.                 System.out.println("Hello, World!"+foo);
    [javac]                                                            ^-^
    [javac] *** Semantic Error: No accessible field named "foo" was found in type "Hello".

BUILD FAILED
/Users/seb/projets/java/ant/build.xml:5: Compile failed; see the compiler error output for details.

Total time: 1 second

While you have this output by changing build.compiler.emacs property to on:

Buildfile: /Users/seb/projets/java/ant/build.xml

compile:
    [javac] Compiling 1 source file to /Users/seb/projets/java/ant
    [javac] Hello.java:5:52:5:54: Semantic Error: No accessible field named "foo" was found in type "Hello".

BUILD FAILED
/Users/seb/projets/java/ant/build.xml:5: Compile failed; see the compiler error output for details.

Total time: 1 second

In the latter version, the messages are less fancy and Emacs is more capable of parsing them.

Upvotes: 3

Related Questions