A component library is a set of related JavaServer Faces components that can be packaged and distributed together in a single file, called a complib file, and imported for use in a project with Visual Web JSF support. A complib file is a type of JAR file with an extension of .complib
instead of .jar
. The file contains the components themselves and their design-time JavaBeans objects packaged in JAR files, as well as other items like source code ZIP files, Javadoc ZIP files, and other JAR files used at runtime and design time. A complib file also has a logical table of contents that is physically split into multiple files and provides information on the component library and lists its contents. A complib file is similar to a WAR file in that it contains other JAR files, content files, and metadata about its contents.
Each component library has a namespace URI and a three-digit version number that identifies the set of components. In addition, a complib specifies which version of J2EE technology its components are compatible with, at present either J2EE 1.4 or Java EE 5, with J2EE 1.4 being the default if none is specified. A component developer can release components using a set of Java packages and associate them with a component library namespace and version number. Each subsequent release of the components can then use the same namespace but a different version number to identify the release. This design allows the IDE to prevent two different versions of component code in the same Java package from being used within the same project, and additionally supports the Update and Replace features of projects with Visual Web JSF support.
A complib file can be imported into the IDE in the Component Library Manager. Importing a complib file expands its contents into the IDE's .netbeans
directory under the user's home directory. You can then add the component library to projects, as described in Importing Components. After you add the library to a project, the component library contents are copied into that project's directory, and the IDE adds JAR files from the newly copied component library to the project's classpath. Copying the component library contents into a project makes the project self-contained so you can package the project and give it to another developer.
When the IDE embeds a component library in a project, the contents are stored under a project's lib/complibs
sub-directory, and a list of all component libraries for the project is maintained in an index.xml
file. Project component libraries are implemented on top of IDE library primitives. In the IDE, Library definitions are managed by the Library Manager and are global resources stored in the .netbeans
directory. Library references are managed by the Project Properties dialog and are per-project resources that point to library definitions. The IDE automatically manages both library definitions and library references when component libraries are used in a project. If you want to remove the library from the IDE, you must remove the library in the Component Library Manager. If you no longer want to use the components in a project, you must separately remove the library from the project's Component Library node, and then clean up any of the library's components that might remain in the project.