February 4, 2016
Posted by on
Recently I had an issue setting the sourceCompatibility for the eclipse plugin. Turns out you can only set this property after the Java plugin has been applied. If you don’t you get a ClassCastException (BigDecimal to JavaVersion).
You can typically set the sourceCompatibility property directly the file after the apply for the Java plugin (but before the eclipse plugin) but in my build I’m using a common build file to apply plugins so I don’t have the flexibility to do that.
Instead I need to use a plugin callback as follows:
sourceCompatibility = 1.6
targetCompatibility = 1.6