Hi,

AFAIK there's no solution for it out of the box.
The pom model has no option to specify it, so it cannot be solved there.
The plugin descriptor is a Maven-only file, so that might work, but requires Maven to understand it. The other possible solution it to write an extension for it, which would also work with older versions of Maven.

This is also one of the main reasons why we still use Java7 to develop, so users won't hit this issue.

Robert

On Thu, 28 Sep 2017 12:46:33 +0200, Konrad Windszus <konra...@gmx.de> wrote:

How can I enforce that my custom Maven Plugin (or only a certain Mojo within) is only executed with at least a certain Java version (i.e. Java8 due to the use of class files being only compatible with Java8+). The prerequisites section which seems like the natural way to define that only allows me to require a minimum Maven version (http://maven.apache.org/ref/3.5.0/maven-model/maven.html#class_prerequisites). which is not what I want here.

The failure message is rather unintuitive whenever my Maven Mojo is used in a project with an incompatible Java version (which cannot read my Mojos class files).

I know that in all Projects using the Maven Plugin the maven-enforcer-plugin could theoretically be used, but then each consuming projects needs to manually figure out the minimum java version based on the documentation of all Maven Plugins. Isn't there a better/more automated way, which let's Maven check this requirement prior to executing any Mojos from a plugin?

Thanks,
Konrad
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to