netbeans-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emma Atkinson <emma.atkins...@gmail.com>
Subject Re: Multi Release JAR files
Date Tue, 02 Oct 2018 11:16:01 GMT
I don't know if this might add to the discussion.  I have tried build a
simple Java application comprising 2 source files (Main.java and
module-info.java) and have it call the default logger for Log4j2 V2.11.1 to
output a single error message.  Nothing more.  I put the
log4j-api-2.11.1.jar on the Modulepath as shown by Project Properties >
Library > Compile tab.

Log4j2 V2.11.1 is a Multi-release JAR (MR-JAR).  The module-info.class file
is in log4j-api-2.11.1.jar under the folder META-INF/versions/9, which
seems to match what the CachingFileManager expects at line 389.  I am not
sure if I am looking at all the right places.

The Netbeans editor can see the module log4j.api because it appears in the
drop-down menu of completion suggestions and does not have wiggly red line
under it.  My simple test program has a module-info.java file that requires
log4j.api and nothing else.  This bit definitely works as I would expect.

The RMB Clean & Build function eventually generates an error pointing to
the line *requires log4j.api* in my module-info.java.  It generates this
error even if I try to compile the module-info.java file on its own.  It
seems to me that the ant build script cannot find module but the Netbeans
editor can.  Unfortunately, I do not understand ant scripts enough to dig
any deeper.

I have tried building this program under JDK-9, JDK-10 and JDK-11.  My
Netbeans runs on JDK-10.  I am learning how to migrate to modules by trial
and error.  I may have made an error, but if I have, I don't know where.

I hope this is helpful.
Emma

On Mon, 1 Oct 2018 at 14:03, Geertjan Wielenga
<geertjan.wielenga@googlemail.com.invalid> wrote:

> Apache NetBeans has support for reading multi-release JARs. They can
> appear on the classpath (modulepath) and the correct types are used, though
> note there is (currently) no support for creating them.
>
> Below is where the reading of multi-release JARs is implemented:
>
>
> https://github.com/apache/incubator-netbeans/blob/master/java/java.source.base/src/org/netbeans/modules/java/source/parsing/CachingFileManager.java
>
> Gj
>
>
>
> On Sun, Sep 30, 2018 at 10:44 AM Patrik Karlström <patrik@trixon.se>
> wrote:
>
>> Yes, that's where I got it from. :) Attended Nicolai's talk at jdays this
>> week and later found the netbeans related info above that got me thinking
>> of what I just could not find in the IDE.
>> I'll poke around in my pom then, thanks.
>>
>>
>> Den sön 30 sep. 2018 kl 10:08 skrev Geertjan Wielenga
>> <geertjan.wielenga@googlemail.com.invalid>:
>>
>>> There's nothing in there specifically about NetBeans, but about Maven --
>>> I don't believe there's anything special done in this area in NetBeans
>>> itself, but that the support for this feature can be used via Maven.
>>>
>>> Gj
>>>
>>> On Sun, Sep 30, 2018 at 9:56 AM Geertjan Wielenga <
>>> geertjan.wielenga@googlemail.com> wrote:
>>>
>>>> This should help:
>>>>
>>>> https://blog.codefx.org/tools/multi-release-jars-multiple-java-versions/
>>>>
>>>> Gj
>>>>
>>>> On Sat, Sep 29, 2018 at 6:26 PM Patrik Karlström <patrik@trixon.se>
>>>> wrote:
>>>>
>>>>> I just found out about Multi Release JAR files and began to look into
>>>>> it on my Apache NetBeans 9 installation.
>>>>>
>>>>> At http://wiki.netbeans.org/NetBeans_9 one can read
>>>>>
>>>>>
>>>>> NetBens 9 will be released from Apache Software Foundation as new
>>>>> Apache project. NetBeans is being donated to ASG by Oracle. NetBeans
9 main
>>>>> theme will be to support this upcoming Java SE 9 release.
>>>>>
>>>>>    - ...
>>>>>    - *Multi Release JAR files to be handled properly by NB Java
>>>>>    Support*
>>>>>
>>>>> Did support for Multi Release JAR files made it to ANB9 and if so, how
>>>>> and where do find it/I set it up for my projects? Or was it a goal for
>>>>> NetBeans itself and I should handle it manually in my poms?
>>>>>
>>>>> /Patrik
>>>>>
>>>>

Mime
View raw message