The current method for locating the idlj compiler class relies on a hard-coded path to tools.jar, relative to the current java.home location. This is inappropriate when utilising Maven's 'cross-compilation' feature, targeting a different javac with the 'maven.compiler.executable' property.
For example, in Jenkins it is possible to declare a JDK 1.5 installation for compilation. However in recent Jenkins versions JDK 1.6 is required for the actual execution of Maven, so the JDK 1.5 path is set according to the Maven instructions[0] and as discussed on Jenkins JIRA[1].
In such an environment, the IDL compiler class identified by the idlj-maven-plugin is actually that of the parent Java 6 runtime, and not that of JDK 1.5 as is used for the rest of the execution. This can cause issues where the JDK 1.5 idlj compiler is required either technically or by project requirements.
I've identified a possible solution and attached the patch - this will use a tools.jar (or classes.jar) relative to the maven.compiler.executable path if specified, and fall back to java.home if necessary.
An alternative approach would be to allow an idlj.compiler.executable property, but I think that re-using the maven-compiler-plugin config is acceptable for the use cases I can imagine.
[0]: http://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-using-different-jdk.html
[1]: https://issues.jenkins-ci.org/browse/JENKINS-18403
|