Skip to content

io microsphere classloading ManifestArtifactResourceResolver

github-actions[bot] edited this page Mar 21, 2026 · 1 revision

ManifestArtifactResourceResolver

Type: Class | Module: microsphere-java-core | Package: io.microsphere.classloading | Since: 1.0.0

Source: microsphere-java-core/src/main/java/io/microsphere/classloading/ManifestArtifactResourceResolver.java

Overview

ArtifactResourceResolver implementation that reads artifact metadata from JAR manifest files.

This resolver looks for artifact information in the META-INF/MANIFEST.MF file of a JAR or directory. It extracts the artifact ID and version using configurable manifest attributes.

Configuration Options

You can customize which manifest attributes are used to extract the artifact ID and version by setting system properties:

  • #ARTIFACT_ID_ATTRIBUTE_NAMES_PROPERTY_NAME: A comma-separated list of attribute names to use for extracting the artifact ID. Default: #DEFAULT_ARTIFACT_ID_ATTRIBUTE_NAMES_PROPERTY_VALUE
  • #VERSION_ATTRIBUTE_NAMES_PROPERTY_NAME: A comma-separated list of attribute names to use for extracting the artifact version. Default: #DEFAULT_VERSION_ATTRIBUTE_NAMES_PROPERTY_VALUE

Example Usage

`// Using default priority
ArtifactResourceResolver resolver = new ManifestArtifactResourceResolver();

// With custom priority
ArtifactResourceResolver resolver = new ManifestArtifactResourceResolver(10);

// With custom class loader and priority
ArtifactResourceResolver resolver = new ManifestArtifactResourceResolver(getClass().getClassLoader(), 10);
 `

Manifest Attribute Examples

The resolver will look at standard and custom manifest attributes. Here's an example MANIFEST.MF:

`Manifest-Version: 1.0
Bundle-Name: my-artifact
Bundle-Version: 1.2.3
Implementation-Title: my-artifact
Implementation-Version: 1.2.3
Automatic-Module-Name: com.example.myartifact
 `

In this case, the resolver would extract:

  • Artifact ID: "my-artifact" (from Bundle-Name)
  • Version: "1.2.3" (from Bundle-Version)

Declaration

public class ManifestArtifactResourceResolver extends StreamArtifactResourceResolver

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.1.10-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 8 ✅ Compatible
Java 11 ✅ Compatible
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

Example 1

// Using default priority
ArtifactResourceResolver resolver = new ManifestArtifactResourceResolver();

// With custom priority
ArtifactResourceResolver resolver = new ManifestArtifactResourceResolver(10);

// With custom class loader and priority
ArtifactResourceResolver resolver = new ManifestArtifactResourceResolver(getClass().getClassLoader(), 10);

Example 2

Manifest-Version: 1.0
Bundle-Name: my-artifact
Bundle-Version: 1.2.3
Implementation-Title: my-artifact
Implementation-Version: 1.2.3
Automatic-Module-Name: com.example.myartifact

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-java-core</artifactId>
    <version>${microsphere-java.version}</version>
</dependency>

Tip: Use the BOM (microsphere-java-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.classloading.ManifestArtifactResourceResolver;

See Also

  • StreamArtifactResourceResolver
  • ArtifactResourceResolver

This documentation was auto-generated from the source code of microsphere-java.

Home

java-annotations

java-core

jdk-tools

lang-model

annotation-processor

java-test

Clone this wiki locally