1

I have a complex build system involving many ant scripts, some targets of which invoke the javac task.

These ant scripts do not provide for a way to request a debug build from javac, i.e. neither debug nor debuglevel parameters of the javac task are specified.

Is it still possible to instruct javac to build with debugging support without changing the build scripts themselves?

The scripts are invoked from console.

mark
  • 59,016
  • 79
  • 296
  • 580

2 Answers2

0

The short answer is no unfortunately :(

ewan.chalmers
  • 16,145
  • 43
  • 60
0

Are the Ant scripts invoking javac by calling an external executable, i.e., is fork=true? If so, you could try putting a wrapper script named javac earlier in the $PATH. A tool like strace could show you exactly how javac is being invoked.

On Unix it could look something like this:

echo '#!/bin/bash
exec /usr/bin/javac -g "${@}"' > ./javac
chmod +x javac
PATH=".:${PATH}" ant build

If Ant is invoking the Java compiler in-process, you can make an edited version of Ant's javac task class that defaults to having debugging turned on, and put this earlier than the official Ant jar in the classpath when invoking Ant.

andrewdotn
  • 32,721
  • 10
  • 101
  • 130