Re[2]: Force JPMS to add module to boot layer

Alex Orlov ooo_saturn7 at mail.ru
Mon Jun 22 17:15:37 UTC 2020


Hi Alan,
 
Thank you very much for your answer. In order to be concrete a test project was created
and it is here  https://github.com/PashaTurok/hibernate-h2-test4
 
Besides, if it is not very difficult for you, could you answer separately to
each questions (# 1 and #2). So, I repeat them again:
 
1) Is it possible to force JPMS to add modules even if it think that they won’t be used
(by the way — nobody asks it).
2) As I understand this problem doesn’t appear when we create child layer and add any jars to it.
In this case JPMS doesn’t ignore any modules. Is this statement right?
 
Best regards,
 
 
 

  
>Понедельник, 22 июня 2020, 18:35 +03:00 от Alan Bateman <alan.bateman at oracle.com>:
> 
>On 21/06/2020 19:52, Alex Orlov wrote:
>> Hi all,
>>
>> New version of maven-failsafe-plugin (3.0.0-M5) has been released and now it is possible to have two module-info in one
>> project — one in src/main/java and one in src/test/java  and to test modules on module -path.
>> Trying to use it I found the following.
>>
>> Failsafe detects right module list using poms and adds it. The problem is that there are jars with module-info, with
>> Automatic-Module-Name and jars without anything. And if any module doesn’t show explicit dependency,
>> module is not added to boot layer by JPMS. For example, I have many hours story with hibernate and fasterxml.
>> In module path I saw:
>> /home/alex/.m2/repository/org/hibernate/hibernate-core/5.4.14.Final/hibernate-core-5.4.14.Final.jar
>> /home/alex/.m2/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar
>> However, I got java.lang.NoClassDefFoundError: com/fasterxml/classmate/TypeResolver
>> Only later, I noticed that on boot layer I had only hibernate (without module-info) but
>> fasterxml (with module-info) was ignored by our lovely JPMS.
>If hibernate is an automatic module, and if is indeed resolved, then
>every observable automatic module will also be resolved. Is there any
>way to get maven-failsafe-plugin to reveal the command line that it is
>using? Alternatively, is there any way to inject the
>"--show-module-resolution" option into the command line that it uses?
>That will help to discovered if hibernate is actually resolved.
>>
>> So, it is necessary to add missed modules via test module-info to boot layer what is a very silly work:
>> 1) you add to you pom dependencies that you don’t use
>> 2) failsafe detects right dependencies using pom files and does it very well.
>>
>> So, could anyone answer two my questions:
>> 1) Is it possible to force JPMS to add modules even if it think that they won’t be used
>> (by the way — nobody asks it).
>> 2) As I understand this problem doesn’t appear when we create child layer and add any jars to it.
>> In this case JPMS doesn’t ignore any modules. Is this statement right?
>>
>If you are add "--add-modules" to the command line then it will allow
>you to make sure that jackson is in the boot layer. That said, it may
>mask some other issue so finding a bit more on what
>maven-failsafe-plugin is doing will help the discussion here.
>
>-Alan 
 
 
--
Alex Orlov
 


More information about the jigsaw-dev mailing list