Including External NetBeans Modules Via Add Project/Add Cluster

When working with Ant-based NetBeans Platform application projects, you can include external NetBeans modules in your application, and set dependencies on them, in one of two ways.

I've never completely understood the difference between the two, so here's my understanding of it now, i.e., the difference between "Add Project" and "Add Cluster" in the "Libraries" tab of the Project Properties dialog of NetBeans Platform application projects:

  • Add Project. Use this approach when you have access to the source of the NetBeans module that you want to include. I.e., somewhere on disk, you will have the sources of another NetBeans Platform application project or a NetBeans module project.

  • Add Cluster. Use this approach when you do not have access to the sources of the application or module you'd like to include. Instead, you have the application binary somewhere, such as the VisualVM application in the JDK. In that case, use "Add Cluster" and the modules in the selected cluster will be accessible to the modules in your application and will be packaged with your application.


In the case of "Add Cluster", you might also want to be able to use code completion and look into the sources of the modules you include. That's why you can explicitly include sources and javadoc when you include a cluster into the application. When you use "Add Project", you have the sources available already, which means that you also have access to the related javadoc, defined within those sources.

If you use "Add Project", the project in question should be built, otherwise your application's build will fail, just as if you had used "Add Cluster", which also uses built modules.

None of this should be confused with transitive builds. I.e., if you have the sources of VisualVM available, and you use "Add Project" to include a module from VisualVM, you will not automatically rebuild the VisualVM module when you rebuild your application. That is not supported. If you really want transitive builds, use Maven instead.

A simple way (I am a simple person) to understand the difference between the two approaches described here is to see "Add Project" as "Reuse External Source" and "Add Cluster" as "Reuse External Binaries".

Comments:

Hi,

I've already tried asking this on the platform-dev forum, but got no bites. It is (fairly) relevant to this post though. :-)

Do you know if it's possible to override selected modules from a cluster you've added, or from core? In particular, I'm trying to do what Jesse Glick mentioned here - http://forums.netbeans.org/post-90569.html - to use a more recent JNA, but the cluster refuses to build if the module is deselected from it.

Posted by guest on August 25, 2011 at 12:12 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today