Yes, I think the "Libraries" UI that's described in the blog post works only on Ant-based NetBeans Platform projects. I'd still recommend using Maven going forward, though.
For Maven, you can click "Add Dependency" in the context menu for the "Dependencies" folder, to help add dependencies to your module's pom.xml. There are usually two kinds of modules you will need to add: "API" modules (typically groupId org.netbeans.api), and implementation modules (typically groupId org.netbeans.modules). The API modules you can find by typing the name of the class you need to use into the Add Dependency UI. The implementation modules are added with " <scope>runtime</scope> ", and you usually find them by running your app and getting an error that some implementation module is not available. > By the way, I notice that by default, a new Maven-based NetBeans Platform > application will declare a dependency on the artifact > org.netbeans.cluster:platform, which in turn depends on many, many other > artifacts (including org.netbeans.modules:org-netbeans-modules.favorites). > If I DON'T want to include one of these things (e.g., the Favorites feature), > what's the right way to remove it from my application? Looking at my own NetBeans Platform application, it does indeed depend on org.netbeans.cluster:platform. I think for things that are included in this cluster, the best way to get rid of them is to remove the relevant actions/menu items etc. from the branding module's layer.xml . Once you have a layer.xml file added to a module, you can expand it in the NetBeans IDE, expand "<this layer in context>", and then start deleting things you don't want. This will generate the required ".instance_hidden" XML configuration lines. Alternatively it might be possible to not include the platform cluster and instead enumerate the relevant modules manually. I haven't tried this myself, though. -- Eirik -----Original Message----- From: Chris Marusich <cmmarus...@gmail.com> Sent: Monday, August 23, 2021 9:14 PM To: users@netbeans.apache.org Subject: How to manage "Platform Modules" in a Maven-based NetBeans Platform application? Hi, I'm experimenting with ways to build NetBeans Platform applications. I'm still new to the platform. I've been told that Maven is the way to go [1]. That's great; I like Maven and have used it for years. However, I'm having trouble understanding how to use (or exclude) NetBeans Platform modules. How does one usually do that? Let me explain my confusion. Consider this blog post from 2010: https://blogs.oracle.com/geertjan/an-xml-editor-in-3-steps-without-any-coding In it, Geertjan describes how to add an XML Editor to your NetBeans Platform application. The critical steps are: 2. Right-click the application, choose Properties, and go to the Libraries panel. - In "platform11", add a checkmark for "Favorites". - In "ide12", add a checkmark for "XML Text Editor" and then click the "Resolve" button. Even today in NetBeans 12.4, these steps basically seem to work in the case of an Ant-based NetBeans Platform application. However, in the case of a Maven-based NetBeans Platform application, the "Libraries" panel doesn't even exist, so it seems it must be done differently. How do you do this in the case of a Maven-based NetBeans Platform application? I have not yet found good documentation that describes how to do this with Maven. Everything I have found so far is specific to the Ant-based scenario. I imagine that adding or removing platform features must not be too difficult. What am I missing? After some experimentation, I did discover that I can right click on the "Dependencies" node of my Maven-based NetBeans Platform application in the Projects window, and from there I can type the word "favorite" into the "Query" field of the "Search" tab. In this way I discovered that an artifact named org.netbeans.modules:org-netbeans-modules.favorites exists in Maven Central. I suppose this single artifact might be what I need for the "Favorites" feature, but who knows? Even if that is the case and nothing else is required, I'm still not sure how I would go from "I read how to do this in an Ant-specific tutorial" to "I know how to do this in the Maven case." By the way, I notice that by default, a new Maven-based NetBeans Platform application will declare a dependency on the artifact org.netbeans.cluster:platform, which in turn depends on many, many other artifacts (including org.netbeans.modules:org-netbeans-modules.favorites). If I DON'T want to include one of these things (e.g., the Favorites feature), what's the right way to remove it from my application? Thank you for reading this far. Hopefully I'm just missing something obvious. Footnotes: [1] https://lists.apache.org/thread.html/r945ab924cfc641ba71bce7c50c61af299446bfbe2b7a1624b1464673%40%3Cusers.netbeans.apache.org%3E [2] https://leanpub.com/nbp4beginners -- 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