|
32 | 32 | import static java.lang.System.getProperty; |
33 | 33 |
|
34 | 34 | /** |
35 | | - * {@link ArtifactResourceResolver} for Manifest |
| 35 | + * {@link ArtifactResourceResolver} implementation that reads artifact metadata from JAR manifest files. |
| 36 | + * |
| 37 | + * <p>This resolver looks for artifact information in the {@code META-INF/MANIFEST.MF} file of a JAR or directory. |
| 38 | + * It extracts the artifact ID and version using configurable manifest attributes.</p> |
| 39 | + * |
| 40 | + * <h3>Configuration Options</h3> |
| 41 | + * <p>You can customize which manifest attributes are used to extract the artifact ID and version by setting system properties:</p> |
| 42 | + * |
| 43 | + * <ul> |
| 44 | + * <li><strong>{@value #ARTIFACT_ID_ATTRIBUTE_NAMES_PROPERTY_NAME}</strong>: A comma-separated list of attribute names to use for extracting the artifact ID. |
| 45 | + * Default: {@value #DEFAULT_ARTIFACT_ID_ATTRIBUTE_NAMES_PROPERTY_VALUE}</li> |
| 46 | + * <li><strong>{@value #VERSION_ATTRIBUTE_NAMES_PROPERTY_NAME}</strong>: A comma-separated list of attribute names to use for extracting the artifact version. |
| 47 | + * Default: {@value #DEFAULT_VERSION_ATTRIBUTE_NAMES_PROPERTY_VALUE}</li> |
| 48 | + * </ul> |
| 49 | + * |
| 50 | + * <h3>Example Usage</h3> |
| 51 | + * <pre> |
| 52 | + * // Using default priority |
| 53 | + * ArtifactResourceResolver resolver = new ManifestArtifactResourceResolver(); |
| 54 | + * |
| 55 | + * // With custom priority |
| 56 | + * ArtifactResourceResolver resolver = new ManifestArtifactResourceResolver(10); |
| 57 | + * |
| 58 | + * // With custom class loader and priority |
| 59 | + * ArtifactResourceResolver resolver = new ManifestArtifactResourceResolver(getClass().getClassLoader(), 10); |
| 60 | + * </pre> |
| 61 | + * |
| 62 | + * <h3>Manifest Attribute Examples</h3> |
| 63 | + * <p>The resolver will look at standard and custom manifest attributes. Here's an example MANIFEST.MF:</p> |
| 64 | + * |
| 65 | + * <pre> |
| 66 | + * Manifest-Version: 1.0 |
| 67 | + * Bundle-Name: my-artifact |
| 68 | + * Bundle-Version: 1.2.3 |
| 69 | + * Implementation-Title: my-artifact |
| 70 | + * Implementation-Version: 1.2.3 |
| 71 | + * Automatic-Module-Name: com.example.myartifact |
| 72 | + * </pre> |
| 73 | + * |
| 74 | + * <p>In this case, the resolver would extract:</p> |
| 75 | + * <ul> |
| 76 | + * <li><strong>Artifact ID:</strong> "my-artifact" (from Bundle-Name)</li> |
| 77 | + * <li><strong>Version:</strong> "1.2.3" (from Bundle-Version)</li> |
| 78 | + * </ul> |
36 | 79 | * |
37 | 80 | * @author <a href="mailto:mercyblitz@gmail.com">Mercy</a> |
38 | 81 | * @see StreamArtifactResourceResolver |
|
0 commit comments