What is the recommended way to retrieve the current Maven version from
within a plugin?

Use case: I want to add a maven version selector to maven-invoker-plugin.
Thus invoker tests which are for 3.x features only will not even try to run
on 2.x, and we can keep the same suite of tests.

I was implementing something like this:

    /**
     * @component
     * @since 1.5
     */
    private RuntimeInformation runtimeInformation;

and then calling runtimeInformation.getApplicationVersion() to get the
version

However, this requires adding a dependency on maven-core, and it is my
understanding that this API (RuntimeInformation) is being deprecated/removed
for 3.x.

So what is the way we should use to determine the Maven version from within
a plugin?

-Stephen

Reply via email to