简体   繁体   中英

How to recreate Eclipse's ignoring of binary incompatibilities in an Ant javac invocation?

Eclipse provides a Java build-time option to ignore problems with incompatible required binaries at compile-time (see screenshot below; Ignore is the default actually):

Eclipse Java构建选项

I had needed this because I'm compiling a library on Eclipse Indigo (which I believe internally uses a 1.7 compiler) with a 1.6 target, but which is dependent on a library with a 1.8 target. (Everything will still be run on a 1.8 JVM where that dependent library is used, so I want the compilation to work.)

However, when I came to translate this to an Ant javac task in a build script, I've no idea how to specify this option (or, indeed, whether it boils down to a single compiler option). Having a look at the Java 6 javac 'man page' doesn't suggest anything obvious. (I appreciate that I am here using a 1.6 compiler — I'm on Ubuntu 12.04 which still has Java 1.6 — instead of Eclipse's internal 1.7 one, but that shouldn't affect the question.)

So:

(i) What does this boil down to in terms of javac options (or, equivalently, how is Eclipse achieving this?)?

(ii) How, if at all, is this translateable to an Ant javac task invocation?

To see the command that Eclipse is running when you click "Run":

  • Go to the Debug window, which is generally within the Debug perspective
  • Expand your application and right click on Java executable underneath (image below in case that's badly explained)

扩展应用

  • Click Properties and see the Command Line box

It could be that Eclipse is explicitly excluding the incompatible library? Hopefully it shows up in the command line box here.

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