[ 
https://issues.apache.org/jira/browse/MTOOLCHAINS-44?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

dennis lucero updated MTOOLCHAINS-44:
-------------------------------------
    Description: 
Currently it is needed to have the toolchains defined in the toolchains.xml 
file. The [Maven Docker images|https://hub.docker.com/_/maven] do not [include 
a useful toolchains file|https://github.com/carlossg/docker-maven/issues/303]. 
But since it’s possible to [derive a usable toolchain from the system 
properties|https://github.com/carlossg/docker-maven/issues/303#issuecomment-1310895631],
 it should not be required to store that information in the toolchains.xml 
file. Instead, Maven should check if the toolchain request could be fulfilled 
by the JDK running Maven.

I’m not sure if it’s reasonable to do this in all cases or only if the 
toolchains file does not contain any toolchain. For example, if the toolchains 
file only contains a Java 16 toolchain and the project requires Java 17 
(exactly, not 17 or later) and Maven is run with Java 17, it would be possible 
to build the project (with Java 17), but probably not a good idea since it will 
fail when the Java installation Maven is running on is updated to version 18.

  was:
Currently it is needed to have the toolchains defined in the toolchains.xml 
file. The [Maven Docker images|https://hub.docker.com/_/maven] do not [include 
a useful toolchains file|https://github.com/carlossg/docker-maven/issues/303]. 
But since it’s possible to [derive a usable toolchain from the system 
properties|https://github.com/carlossg/docker-maven/issues/303#issuecomment-1310895631],
 it should not be required to store that information in the toolchains.xml 
file. Instead, Maven should check if the toolchain request could be fulfilled 
by the JDK running Maven.

I’m not sure if it’s reasonable to do this in all cases or only if the 
toolchains file does not contain any toolchain. For example, if the toolchains 
file does contain a JDK 16 toolchain, the project requires JDK 17 (exactly, not 
17 or later) and Maven is run with Java 17, it may be desirable to fail since 
it’s probably an oversight to not have JDK 17 included in the toolchains file 
and it would break when running Maven after an upgrade to Java 18 anyway. But 
the Docker images do not have any entries in the toolchains.xml file and in 
that case it would be useful to use the JDK Maven is running on if the version 
matches the requested one.


> Use default JDK if it matches the request and no other toolchain is defined
> ---------------------------------------------------------------------------
>
>                 Key: MTOOLCHAINS-44
>                 URL: https://issues.apache.org/jira/browse/MTOOLCHAINS-44
>             Project: Maven Toolchains Plugin
>          Issue Type: Improvement
>    Affects Versions: 3.1.0
>            Reporter: dennis lucero
>            Priority: Major
>
> Currently it is needed to have the toolchains defined in the toolchains.xml 
> file. The [Maven Docker images|https://hub.docker.com/_/maven] do not 
> [include a useful toolchains 
> file|https://github.com/carlossg/docker-maven/issues/303]. But since it’s 
> possible to [derive a usable toolchain from the system 
> properties|https://github.com/carlossg/docker-maven/issues/303#issuecomment-1310895631],
>  it should not be required to store that information in the toolchains.xml 
> file. Instead, Maven should check if the toolchain request could be fulfilled 
> by the JDK running Maven.
> I’m not sure if it’s reasonable to do this in all cases or only if the 
> toolchains file does not contain any toolchain. For example, if the 
> toolchains file only contains a Java 16 toolchain and the project requires 
> Java 17 (exactly, not 17 or later) and Maven is run with Java 17, it would be 
> possible to build the project (with Java 17), but probably not a good idea 
> since it will fail when the Java installation Maven is running on is updated 
> to version 18.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to