I agree with everything Emilian said in the other post. My own experience:

1) I have never tried JPMS.
2) Yes, maven-based NetBeans Platform projects work great. I switched my 
NetBeans Platform project to Maven several years ago, and haven't had any 
problems with it compared to ant.
3) Yes, each external library must be wrapped in a NetBeans wrapper module 
(which is usually just a folder with one pom.xml file and one manifest.mf 
file). Usually there is no need to download the JAR manually, if Maven can find 
it.
4) In my case I have a custom script which generates a ZIP file for 
distribution of the application for Linux, a ZIP file for Windows, and a DMG 
file with an application bundle for MacOS. The script uses the ZIP file 
generated from the NetBeans Platform build as its input. It also copies in a 
platform-appropriate JRE for each OS, and points the netbeans.conf (or 
myapp.conf or whatnot) file to it.

I never used the NetBeans-generated installers, although at some point I'll 
want to figure out how to build a proper installer on Windows. Though I might 
look into building an MSI rather than an EXE installer there. 

In recent Java versions, you need to use the jlink command to generate a 
customized JRE from the JDK (which involves figuring out which JDK modules your 
applications needs).

When bundling a JRE/JDK, avoid using the Oracle one, as it has some unpleasant 
license terms--you can use e.g. Zulu's JDK distro instead.

On MacOS it is now more-or-less mandatory to "notarize" the application bundle 
before distributing it. This requires an Apple developer subscription and a 
MacOS machine.

I have never used jpackage.

-- Eirik
https://twitter.com/ultorg

-----Original Message-----
From: Chris Marusich <cmmarus...@gmail.com> 
Sent: Wednesday, July 7, 2021 9:24 PM
To: users@netbeans.apache.org
Subject: NetBeans Platform "Golden Path"

Hi,

What's the current "best practice" or "golden path" for building and 
distributing a NetBeans Platform application and managing its dependencies 
(e.g., from Maven central)?  That's a big general question, so I'll ask some 
specifics:

- Should I ever try to use JPMS modules when building a NetBeans Platform 
application?  I've found that in my projects (which are NetBeans Maven-based 
projects, not NetBeans Platform projects), when I use JPMS modules, it can 
cause problems for NetBeans [1], so I wonder if it's really wise to even try 
mixing JPMS modules with NetBeans projects at this time, let alone NetBeans 
Platform projects.

- Should I ever try to make a Maven-based NetBeans Platform application?
I see there are Maven templates in NetBeans that offer to create a Maven-based 
NetBeans Platform project.  However, all the examples online and in books that 
I've seen so far do NOT use Maven.  In spite of this, recent emails on this 
list have suggested that Maven-based NetBeans projects are generally preferred 
over the older Ant-based project types.
So I'm a bit confused about what the currently prevailing wisdom on this matter 
is, in the case of NetBeans Platform projects.  Perhaps Maven can be used to 
build NetBeans Platform applications/modules or not, depending on the 
situation.  As a beginner in the world of NetBeans Platform, I just want to try 
making a NetBeans Platform project using whatever approach is more likely to 
work without trouble and remain supported by the community.  But what approach 
might that be?

- If I want to use a library that is available from Maven central in my 
NetBeans Platform application, is the best option to just manually download the 
JAR file, manually create a NetBeans Platform "wrapper module" for the JAR, and 
then use the "wrapper module" in my application?  I tried using the 
nbm-maven-plugin to use dependencies from Maven in a simple NetBeans Platform 
application, but I encountered problems and couldn't figure out how to get it 
to work.  So to me it feels like the answer to this question is "yes, at the 
moment you should manage your JARs manually in order to have the best developer 
experience when working on a NetBeans Platform application," but I'm not sure.  
I'm curious to hear the opinions of people who have more experience with the 
NetBeans Platform.

- If I want to build a stand-alone release of my NetBeans Platform application 
that I can distribute to an end user, what's a good way to do it?  It seems 
that some of the features in NetBeans that build a stand-alone release will 
only work when your project is not a Maven-based NetBeans Platform application. 
 Additionally, although recent developments like jlink and jpackage have made 
it somewhat easier to produce stand-alone application bundles that don't 
require the user to first install a JRE, which is nice, it seems that these 
tools sometimes require the use of JPMS modules, which can be problematic in 
NetBeans (see above).  And in any case NetBeans does not yet seem to expose any 
way to take advantage of these new tools.  So what IS the most common way that 
people build a release version of a NetBeans Platform application, anyway?
  
Ultimately, I just don't understand what the current "best practice" or "golden 
path" is for using NetBeans Platform.  I'd like to know, though.
I am happy to help improve the tutorials, but the problem is that even after 
reading various tutorials and documentation, and even after experimenting quite 
a bit on my own, I don't even understand what the path of least resistance is 
supposed to be.

Footnotes:
[1] 
http://mail-archives.apache.org/mod_mbox/netbeans-users/202010.mbox/%3c87sg9wgt19....@gmail.com%3E

--
Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to