You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Helmut Leininger <h....@gmx.at> on 2021/12/12 18:51:32 UTC

Java modular project and libraries

Hi,

I am using NB 12.6 and have created a Ant Java Modular project. Some of
the modules use libraries (e.g. access to databases, ...)
I can run the project from NetBeans without problems.

Clean and build suggests the following:

C:\OpenSourceTools\AdoptiumJava\jdk-17/bin/java --module-path
D:\Disk_D\Development\DivTools\ODFToolkit\simple-odf-0.8.2-incubating.jar;.....
-m MeinStammbaum/mstb.GUI.MainWindow

i.e. absolute paths for the libraries used by the modules.

I would very much like to include these libraries to the distribution
(dist). Any help for how to integrate it into the build.xml would be
appreciated.

Regards
Helmut Leininger

Re: Java modular project and libraries

Posted by Helmut Leininger <h....@gmx.at>.
Hi Lisa,

this will most probably work. But there are some inconveniences

- In a non-modular Ant-driven project, if you add a libraries (defined
as Library in Netbeans, each may consist of one or more jar files) to
the project, during "Clean and Build" Netbeans creates a lib folder in
dist and copies the jar files into it automatically. Also, the proposed
comand to execute is adapted to this

- in a modular Ant-driven project, the libraries can be added as above
(to each module instead of the project) and can be seen in the Project
Properties/Libraries in the Modulepath.
During Clean and build, separate jar files are created in dist for each
module, but there is no lib fiolder created and the libraries' jar files
are not coped into it.

Of course, I could use your method, but this implies to address each jar
file of the referred libraries separately (they are in different
directories) and the list would not be updated automatically when new
libraries are added to the project.

Regards
Helmut

Am 13.12.2021 um 02:35 schrieb Lisa Ruby:
> I use Ant, but my project is not modular, so don't know if what I do to
> include jar files I need in my build will work for you, but this is what
> works for me. This is an example using your jar file. You could probably
> put the copy under the "-post-jar" target, rather than "-post-compile"
> if you prefer:
>
>       <target name="-post-compile">
>           <!-- Copy jar file into dist folder  -->
>           <copy
> file="D:\Disk_D\Development\DivTools\ODFToolkit\simple-odf-0.8.2-incubating.jar"
> todir="${dist.dir}"/>
>       </target>
>
> Regards,
> Lisa Ruby
>
> On 12/12/2021 10:51 AM, Helmut Leininger wrote:
>> Hi,
>>
>> I am using NB 12.6 and have created a Ant Java Modular project. Some
>> of the modules use libraries (e.g. access to databases, ...)
>> I can run the project from NetBeans without problems.
>>
>> Clean and build suggests the following:
>>
>> C:\OpenSourceTools\AdoptiumJava\jdk-17/bin/java --module-path
>> D:\Disk_D\Development\DivTools\ODFToolkit\simple-odf-0.8.2-incubating.jar;.....
>> -m MeinStammbaum/mstb.GUI.MainWindow
>>
>> i.e. absolute paths for the libraries used by the modules.
>>
>> I would very much like to include these libraries to the distribution
>> (dist). Any help for how to integrate it into the build.xml would be
>> appreciated.
>>
>> Regards
>> Helmut Leininger
>>
>