Reputation: 4182
After spending an entire day trying to understand why maven does not want to switch jdk based on the entry in the compiler-plugin (see http://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-using-different-jdk.html) I discovered that the compiler is switching correctly, but the jar tool is not. Consider the following facts:
I've added the multi-catch block in my code as a test. If I set the tag to java 7, it compiles. If I change to 1.6 it breaks. This is expected behaviour.
However, if I remove the diamond operator (i.e. compiling in both), and I compile with Java 6, I get the following in my manifest file:
Manifest-Version: 1.0 Archiver-Version: Plexus Archiver Created-By: Apache Maven Built-By: jaco Build-Jdk: 1.7.0_147-icedtea ...
This is of course rather ambiguous. Is there any way to set the correct "jar tool" as well so that the manifest file will reflect the version being used?
Upvotes: 1
Views: 5848
Reputation: 14951
Toolchains plugin may help here, not sure, haven't tried it.
http://maven.apache.org/plugins/maven-toolchains-plugin/
Upvotes: 0
Reputation: 15104
One way here, using Maven/Ant:
Maven: Adding Custom Attributes and Build Timestamp to Manifest
Upvotes: 2