[ 
https://issues.apache.org/jira/browse/MNG-7121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17310652#comment-17310652
 ] 

Pablo Grisafi commented on MNG-7121:
------------------------------------

Please, allow me to insist in my original idea. And sorry in advance if my 
english is not clear enough.

 

While tools like sdk, jenv, alternatives solve the "I have 3 proyects with 
different JDK's" problem, they also change your current environment, which is 
undesirable. You want to compile project A with JDK-A and project B with JDK-B, 
you don't want to change your environment. They are also another tool you need 
to install, mantain, learn, etc.

 

toolchains plugin is better in the sense that your environment is safe, but 
needs manual xml editing to locate the installed jdk, and you also need to 
manually install the JDK's. Autodetecting JDK's is too error prone and even if 
it works, you may not have installed the one you need for a particular project.

 

I understand I'm asking for an extension in the maven scope, but not such a 
huge extension. Philosophicaly you can make the case that a JDK is a ( 
particular kind of ) dependency, since it is something you need in order to 
compile your project. JDK's are now in the same situation dependencies were 
before maven: They are a part of your project you don't include in the version 
control system, you need to have them before compiling the project, and 
everybody has a different setup in his/her own machine. And from the practical 
side, what I'm asking can be thought as an extension to the toolchains plugin.  
I know it has some particular challenges since JDK's do not have maven 
coordinates, but I suspect JDK's builders could be reach and most of them would 
be happy to upload their jdk to maven central. Oracle probably not, because 
they really want you to click some checkbox in order to download something.

 

If this is doable, it has other benefits: IDE's can start looking for JDK's in 
the new standard directory, every project becomes more easy to start working 
on, there is one less thing to worry about, one requirement less you need to 
document, etc.

 

Of course my ignorance about maven internals is showing, maybe it is impossible 
or just too complex or is against maven goals or there is a better way . This 
is nothing but a suggestion. 

 

Thanks and sorry about the wall of text!

> better support for multiple JDK
> -------------------------------
>
>                 Key: MNG-7121
>                 URL: https://issues.apache.org/jira/browse/MNG-7121
>             Project: Maven
>          Issue Type: New Feature
>          Components: core
>            Reporter: Pablo Grisafi
>            Priority: Major
>
> Java evolves at a much faster pace now. In the compay I work for we have 
> projects on Java 6 (sadly yes), 8, 11 and 15.
>  
> The toolchains plugin helps, but it involves manually editing an  xml file, 
> and in my experience people tend to forget about it.
>  
> I think a better user experiense would be a ~/.m2/jdks folder, with one 
> subfolder per jdk, a little like sdkman does it.
> Maven could even automaticlly download the one you need for a specific 
> project if it is not already present, like it does with any dependency. It 
> will be more portable and less manual work. Dependency handling and jdk 
> handling will be managed be maven in a consistent way, cloning a project from 
> github will be way more straightforward.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to