In a specific project I am (at the moment) only allowed to use JRE6 for execution of a Java application. Therefore, I configured maven-compiler-plugin
with 1.6 for both source and target.
In my Maven dependencies, I included a dependency that itself targets 1.7 and also uses 1.7 features like try-with-resources -- which I assumed would lead to some compile-time error or warning in my own project (I'm using Eclipse). But it doesn't, so my question is: Is it possible to detect such problems before running the application (or tests) on the specific target JRE which in my case is JRE6?
Although just a partial answer, I found a solution for Mihai's mentioned issue with different library signatures. There is the Animal Sniffer Maven Plugin which lets you specify a certain Java runtime that it checks against in some phase (e.g. test).
But this doesn't solve the class file version problem, as Maven simply swallows (-nowarn) those warnings from javac, as explained in a comment to this question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With