-
Notifications
You must be signed in to change notification settings - Fork 1
DevFaqModuleDependencies
The nuts and bolts of module dependencies are as follows:
-
Modules can load classes from modules they depend on. They have to declare a dependency on them.
-
NetBeans does not care about things like the
CLASSPATH
environment variable - it knows how to find modules in an installation of NetBeans, and enforces dependencies between them.
What this means is that if
-
Module B tries to use a class from module A, but module B does not explicitly state that it depends on A, or…
-
Module B tries to use a class from module A, and it does declare a dependency on Module A, but the package that class is in is not in the list of packages A says other modules can touch…
then a NoClassDefFoundException
will be thrown at runtime.
(If you even get that far - the module build harness will refuse to even compile module B in such cases.)
An exception to the second item is that if Module B declares an implementation dependency on module A, then it will have access to the full set of classes. Normally you should not need to do this, and anyway it will then be hard to upgrade B independently of A.
Modules can also load classes from libraries - JAR files that are packaged with the module (see DevFaqHowPackageLibraries). Some points to remember about libraries:
-
They are delivered to the user inside the NBM file if they are not part of a full application based on NetBeans.
-
When unpacked, the module will end up in
$SOMECLUSTER/modules/
and any libraries will end up in$SOMECLUSTER/modules/ext/
. -
The module will use the library by having an entry in its manifest
Class-Path: ext/someLibrary.jar
the same way any JAR would.
If you are using the IDE’s module development support,
you will manage module dependencies in the properties dialog for your module
(or the Libraries node in the Projects tab).
This just modifies yourmodule/nbproject/project.xml
.
The data saved there is then used to generate the appropriate manifest entries for you.
If you are writing a module that will use some third party libraries, you probably want to read DevFaqWrapperModules and also DevFaqWhenUseWrapperModule.
For more details, see the reference documentation about classloading in NetBeans.
<hr/>
Applies to: NetBeans 6.8 and above
The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.
This page was exported from http://wiki.netbeans.org/DevFaqModuleDependencies , that was last modified by NetBeans user Rmichalsky on 2009-12-02T13:40:56Z.
NOTE: This document was automatically converted to the AsciiDoc format on 2018-01-26, and needs to be reviewed.
Apache NetBeans is an effort undergoing incubation at The Apache Software Foundation (ASF).
Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects.
While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
This wiki is an experiment pending Apache NetBeans Community approval.