Java – Ant fails to build:”Compile failed; see the compiler error output for details.”

antjavajmeter

I have the same problem as in this two questions:

I've detected which line of code causes this issue.

org.apache.jmeter.protocol.http.proxy.gui.ProxyControlGui proxyControlGui =
                    new org.apache.jmeter.protocol.http.proxy.gui.ProxyControlGui();

This string is used in:

package org.apache.jmeter;

public class JMeter implements JMeterPlugin {

ProxyControlGUI

package org.apache.jmeter.protocol.http.proxy.gui;
public class ProxyControlGui extends LogicControllerGui implements JMeterGUIComponent, ActionListener, ItemListener, KeyListener, UnsharedComponent

If I comment this string – build is successful.
Compiler does not complain during developing in IDE.

I need to know:

  • what's the reason of such behavior?
  • where to see log with details(I'm new with ant)?
  • how rewrite code to avoid javac error?

Log from running ant in CL:

    Buildfile: D:\src\apache-jmeter-custom\build.xml
compile-core:
    [javac] Compiling 1 source file to D:\src\apache-jmeter-custom\build\core
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6
    [javac] D:\src\apache-jmeter-custom\src\core\org\apache\jmeter\JMeter.java:360: error: package org.apache.jmeter.protocol.http.proxy.gui does not exist
    [javac]                 org.apache.jmeter.protocol.http.proxy.gui.ProxyControlGui proxyControlGui =
    [javac]                                                          ^
    [javac] D:\src\apache-jmeter-custom\src\core\org\apache\jmeter\JMeter.java:361: error: package org.apache.jmeter.protocol.http.proxy.gui does not exist
    [javac]                         new org.apache.jmeter.protocol.http.proxy.gui.ProxyControlGui();
    [javac]                                                                      ^
    [javac] 2 errors
    [javac] 1 warning

Ant log from IDEA:

Compiling 1 source file to D:\src\apache-jmeter-custom\build\core
: [options] bootstrap class path not set in conjunction with -source 1.6
D:\src\apache-jmeter-custom\src\core\org\apache\jmeter\JMeter.java (360:58)error: package org.apache.jmeter.protocol.http.proxy.gui does not exist
D:\src\apache-jmeter-custom\src\core\org\apache\jmeter\JMeter.java (361:70)error: package org.apache.jmeter.protocol.http.proxy.gui does not exist
2 errors
1 warning

Thanks in advance.

Best Answer

Ant is a build tool which looks up the dependencies which we specify in the ivy.xml and uses a script to compile the sources after loading the dependencies into the classpath. If there is a compiler failure during your ant script and IDE is not showing an error, the probable reason is that the jar required for building the class is available in the IDE build path and not in the Ant IVY.xml.

Related Topic