Class EpisodeJarSupport
- java.lang.Object
-
- org.codehaus.mojo.jaxb2.javageneration.EpisodeJarSupport
-
public final class EpisodeJarSupport extends Object
Locates JAXB episode resources within artifact JARs and materializes them as local files suitable for XJC external binding inputs. The episode discovery order is:- An explicitly configured resource path, if provided.
META-INF/sun-jaxb.episode(the JAXB RI convention).META-INF/JAXB/sun-jaxb.episode.xjb.- The single
.xjbfile directly withinMETA-INF/JAXB/(the location used by this plugin when packaging generated episodes), provided exactly one such file exists.
- Since:
- 4.1.1
- See Also:
EpisodeArtifact
-
-
Field Summary
Fields Modifier and Type Field Description static StringMOJOHAUS_EPISODE_DIRECTORYThe episode location used by this plugin's owngetEpisodeFilemechanism.static StringSTANDARD_EPISODE_RESOURCEThe standard JAXB RI episode resource location.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FileextractEpisodeEntry(File artifactFile, String entryName, Path extractionRoot, String groupId, String artifactId, String version)Extracts the supplied entry from the artifact JAR to a deterministic location beneathextractionRoot:groupId/artifactId/version/entryName.static StringselectEpisodeEntry(File artifactFile, String explicitResourcePath, String coordinate)Selects the episode entry within the supplied artifact file, following the discovery order defined by this class.
-
-
-
Field Detail
-
STANDARD_EPISODE_RESOURCE
public static final String STANDARD_EPISODE_RESOURCE
The standard JAXB RI episode resource location.- See Also:
- Constant Field Values
-
MOJOHAUS_EPISODE_DIRECTORY
public static final String MOJOHAUS_EPISODE_DIRECTORY
The episode location used by this plugin's owngetEpisodeFilemechanism.- See Also:
- Constant Field Values
-
-
Method Detail
-
selectEpisodeEntry
public static String selectEpisodeEntry(File artifactFile, String explicitResourcePath, String coordinate) throws org.apache.maven.plugin.MojoExecutionException
Selects the episode entry within the supplied artifact file, following the discovery order defined by this class. Extracted episode files preserve the timestamp of the source JAR entry, so that incremental builds re-generate only when the episode artifact changes.
- Parameters:
artifactFile- The resolved artifact file (JAR) to search.explicitResourcePath- An explicit resource path within the artifact, ornullfor auto-discovery.coordinate- The Maven coordinate of the artifact, used in diagnostics.- Returns:
- The name of the selected JAR entry, or
nullif no episode was found. - Throws:
org.apache.maven.plugin.MojoExecutionException- If the artifact is not a readable JAR, an explicitly configured resource path does not exist, or multiple episode candidates exist.
-
extractEpisodeEntry
public static File extractEpisodeEntry(File artifactFile, String entryName, Path extractionRoot, String groupId, String artifactId, String version) throws org.apache.maven.plugin.MojoExecutionException
Extracts the supplied entry from the artifact JAR to a deterministic location beneath
extractionRoot:groupId/artifactId/version/entryName. Guarded against path traversal (ZIP-slip). The extracted file is stamped with the JAR entry's timestamp (or the artifact file's, if the entry has none), enabling stable incremental builds.- Parameters:
artifactFile- The resolved artifact file (JAR).entryName- The JAR entry name to extract.extractionRoot- The root directory beneath which the entry is materialized.groupId- The groupId of the artifact (used for the target path).artifactId- The artifactId of the artifact (used for the target path).version- The version of the artifact (used for the target path).- Returns:
- The extracted, existing episode file.
- Throws:
org.apache.maven.plugin.MojoExecutionException- If the JAR cannot be read or the entry cannot be extracted.
-
-