I'm maintaining a parent pom for my team which will provide the latest compatible version of various maven plugins per the JDK that the project uses. Sometimes if a project utilizes an older version of Java (like 1.5) maven will fail due to a plugin requiring a newer version. Is there a way to get a map of a given plugin and see what the minimum java version is for said plugin? I was thinking there was some sort of report or something that would show me that, but I'm not seeing anything.
-
_If_ the plugin states it, yes. But that's a big _if_. There's no real way I'm afraid. – Tunaki Feb 22 '16 at 16:13
-
The solution may already exist [Option 1](http://stackoverflow.com/questions/12414209/compile-maven-module-with-different-java-version) [Option 2](http://stackoverflow.com/questions/3227054/configuring-maven-with-two-versions-of-java) Regards – Harold Castillo Feb 22 '16 at 16:15
-
@HaroldCastillo, I have a solution that will intelligently select which version of maven and which version of java to use. What I'm after is that given a jdk (like 1.5), what is the latest version of each plugin (for example the clean plugin) that I can use? – Jason Thompson Feb 22 '16 at 19:28
2 Answers
What about: https://builds.apache.org/view/M-R/view/Maven/job/dist-tool-plugin/site/dist-tool-prerequisites.html Apart from that on every plugin page you can find the goals page which contains the information you need. One more thing if you are using not the most uptodate versions all older versions pages are available where you can look at which version which JDK versions uses. It shouldn't be problem to write some kind of script to programmatically extract the information of the older plugins. The above site contains the informations of the uptodate plugins.
Apart from that plugin version selection basead on JDK version is not a good idea. The plugins have only a minimum version for JDK they need to run with. Apart from that they run on all versions (already on JDK 9 with one exception)...Furthermore plugins might require a minimum Maven version to run with which is either Maven 2.2.1 or Maven 3.0+ which shouldn't a problem.
You should define your plugins versions simply based on problems you might have but i would recommend to keep uptodate with your plugins.
If you need running you build with JDK 6 for example, but you use Maven 3.3.X which needs JDK 7 to run you can achieve this by using toolchain to handle this situation.

- 92,914
- 28
- 189
- 235
-
That first link helps quite a bit since it shows the minimum jdk for the latest version of common plugins. Though I'd like to figure out how to take a specific plugin, like the clean plugin, and figure out at what point did it require 1.6 rather than 1.5. – Jason Thompson Feb 22 '16 at 19:30
-
Starting with 3.0.0 it started to require JDK 6, cause the 3.0.0 line of the plugins starts to require JDK 1.6 (unfortunately there are exceptions)...[See also the announcment on mailing list](http://maven.40175.n5.nabble.com/ANNOUNCEMENT-End-Of-Life-of-Maven-2-2-1-Plugins-JDK-Roadmap-td5829827.html). – khmarbaise Feb 23 '16 at 08:11
In theory this shouldn't be an issue. Maven will use the Java version you run it with, so the plugin's dependency will be satisfied, independent of the project's language level. Just make sure your devs are using a current version.
Example: running Maven with Java 8 will satisfy the dependency of a Plugin that requires Java 8, independent of the project's source and target level.
(With dependencies it's more complicated, I am afraid, but since you are not actually coding against your plugins, you should be fine)

- 292,901
- 67
- 465
- 588