Hi,
I work with many Maven projects which require building with different
JDKs: Java 8, Java 11, Java 17, and so on. I have all these installed
side by side in my build machine.
Maven Toolchains plugin is very helpful because it prevents me from
being forced to reconfigure environment variable JAVA_HOME when I move
between Maven projects.
However, for those who only use one of those projects, configuring the
toolchains and JDKs is too complicated. They have their Java already
configured to use the correct JDK.
It would be convenient if Maven Toolchains plugin had a fallback mode:
when the file .m2/toolchains.xml is not present, i.e. the toolchains are
not configured, Maven Toolchains plugin would simply fall back to use
the same Java as Maven itself uses.
Maven Toolchains plugin could have a setting to allow the fallback. By
default, the fallback would not be allowed. This is the behavior now.
Even when using toolchains, I am also using Maven Enforcer rule
RequireJavaVersion to limit the range of usable Java versions. This rule
only tracks the version of the Java runtime Maven itself is using so it
is not compatible with Maven Toolschains.
To work with Maven Toolchains plugin and remain backwards compatible,
Maven Enforcer would need a new rule, maybe
"RequireJDKVersion", "RequireToolchainJavaVersion" or
"RequireJavaCompilerVersion". It would also have to work with the
fallback mode as described above.
Would the above be the right direction to develop Maven Toolchains?
Thanks for all comments.
Sincerely,
Mikko Koivunalho
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org