Class LibraryBuilder

All Implemented Interfaces:
Generator, Renamable, ResourceProvider, ResourceRetriever
Direct Known Subclasses:
UberJarBuilder

public class LibraryBuilder extends JarBuilder implements ResourceRetriever

A Generator for Java libraries packaged as jars. A library jar is expected to contain class files and supporting resources together with additional information in META-INF/.

The generator provides two types of resources.

  1. A JarFile. This type of resource is also returned if a more general ResourceType such as ClasspathElement is requested.

  2. An AppJarFile. When requesting this special jar type, the generator checks if a main class is specified.

In addition to explicitly adding resources, this generator supports resource retrieval from added providers. The resources of type ClassTree and JavaResourceTree that the providers supply will be used in addition to the explicitly added resources.

The standard pattern for creating a library is simply:

generator(LibraryGenerator::new).from(this);