Class LibraryGenerator

All Implemented Interfaces:
Generator, ResourceProvider, ResourceRetriever
Direct Known Subclasses:
UberJarGenerator

public class LibraryGenerator extends JarGenerator 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.

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

The standard pattern for creating a library is simply:

generator(LibraryGenerator::new).from(providers(Supply));