Package org.apache.maven.archiver
Class MavenArchiver
- java.lang.Object
-
- org.apache.maven.archiver.MavenArchiver
-
public class MavenArchiver extends Object
- Author:
- Emmanuel Venisse, kama
-
-
Field Summary
Fields Modifier and Type Field Description static StringREPOSITORY_LAYOUTRepository layout.static StringREPOSITORY_LAYOUT_NONUNIQUERepository layout non unique.static StringSIMPLE_LAYOUTThe simply layout.static StringSIMPLE_LAYOUT_NONUNIQUEsimple layout non unique.
-
Constructor Summary
Constructors Constructor Description MavenArchiver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DateconfigureReproducible(String outputTimestamp)Configure Reproducible Builds archive creation if a timestamp is provided.voidcreateArchive(MavenSession session, MavenProject project, MavenArchiveConfiguration archiveConfiguration)JarArchivergetArchiver()ManifestgetManifest(MavenSession mavenSession, MavenProject project, ManifestConfiguration config)protected ManifestgetManifest(MavenSession session, MavenProject project, ManifestConfiguration config, Map<String,String> entries)ManifestgetManifest(MavenSession session, MavenProject project, MavenArchiveConfiguration config)ManifestgetManifest(MavenProject project, ManifestConfiguration config)Return a pre-configured manifest.DateparseOutputTimestamp(String outputTimestamp)Parse output timestamp configured for Reproducible Builds' archive entries, either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXXor as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH.voidsetArchiver(JarArchiver archiver)voidsetBuildJdkSpecDefaultEntry(boolean buildJdkSpecDefaultEntry)Add "Build-Jdk-Spec" entry as part of default manifest entries (true by default).voidsetCreatedBy(String description, String groupId, String artifactId)Define a value for "Created By" entry.voidsetOutputFile(File outputFile)
-
-
-
Field Detail
-
SIMPLE_LAYOUT
public static final String SIMPLE_LAYOUT
The simply layout.- See Also:
- Constant Field Values
-
REPOSITORY_LAYOUT
public static final String REPOSITORY_LAYOUT
Repository layout.- See Also:
- Constant Field Values
-
SIMPLE_LAYOUT_NONUNIQUE
public static final String SIMPLE_LAYOUT_NONUNIQUE
simple layout non unique.- See Also:
- Constant Field Values
-
REPOSITORY_LAYOUT_NONUNIQUE
public static final String REPOSITORY_LAYOUT_NONUNIQUE
Repository layout non unique.- See Also:
- Constant Field Values
-
-
Method Detail
-
getManifest
public Manifest getManifest(MavenSession session, MavenProject project, MavenArchiveConfiguration config) throws ManifestException, DependencyResolutionRequiredException
- Parameters:
session- the Maven Sessionproject- the Maven Projectconfig- the MavenArchiveConfiguration- Returns:
- the
Manifest - Throws:
ManifestException- in case of a failureDependencyResolutionRequiredException- resolution failure
-
getManifest
public Manifest getManifest(MavenProject project, ManifestConfiguration config) throws ManifestException, DependencyResolutionRequiredException
Return a pre-configured manifest.- Parameters:
project-MavenProjectconfig-ManifestConfiguration- Returns:
Manifest- Throws:
ManifestException- Manifest exception.DependencyResolutionRequiredException- Dependency resolution exception.
-
getManifest
public Manifest getManifest(MavenSession mavenSession, MavenProject project, ManifestConfiguration config) throws ManifestException, DependencyResolutionRequiredException
- Parameters:
mavenSession-MavenSessionproject-MavenProjectconfig-ManifestConfiguration- Returns:
Manifest- Throws:
ManifestException- the manifest exceptionDependencyResolutionRequiredException- the dependency resolution required exception
-
getManifest
protected Manifest getManifest(MavenSession session, MavenProject project, ManifestConfiguration config, Map<String,String> entries) throws ManifestException, DependencyResolutionRequiredException
- Parameters:
session-MavenSessionproject-MavenProjectconfig-ManifestConfigurationentries- The entries.- Returns:
Manifest- Throws:
ManifestException- the manifest exceptionDependencyResolutionRequiredException- the dependency resolution required exception
-
getArchiver
public JarArchiver getArchiver()
- Returns:
JarArchiver
-
setArchiver
public void setArchiver(JarArchiver archiver)
- Parameters:
archiver-JarArchiver
-
setOutputFile
public void setOutputFile(File outputFile)
- Parameters:
outputFile- Set output file.
-
createArchive
public void createArchive(MavenSession session, MavenProject project, MavenArchiveConfiguration archiveConfiguration) throws ManifestException, IOException, DependencyResolutionRequiredException
- Parameters:
session-MavenSessionproject-MavenProjectarchiveConfiguration-MavenArchiveConfiguration- Throws:
ArchiverException- Archiver Exception.ManifestException- Manifest Exception.IOException- IO Exception.DependencyResolutionRequiredException- Dependency resolution exception.
-
setCreatedBy
public void setCreatedBy(String description, String groupId, String artifactId)
Define a value for "Created By" entry.- Parameters:
description- description of the plugin, like "Maven Source Plugin"groupId- groupId where to get version in pom.propertiesartifactId- artifactId where to get version in pom.properties- Since:
- 3.5.0
-
setBuildJdkSpecDefaultEntry
public void setBuildJdkSpecDefaultEntry(boolean buildJdkSpecDefaultEntry)
Add "Build-Jdk-Spec" entry as part of default manifest entries (true by default). For plugins whose output is not impacted by JDK release (like maven-source-plugin), adding Jdk spec adds unnecessary requirement on JDK version used at build to get reproducible result.- Parameters:
buildJdkSpecDefaultEntry- the value for "Build-Jdk-Spec" entry- Since:
- 3.5.0
-
parseOutputTimestamp
public Date parseOutputTimestamp(String outputTimestamp)
Parse output timestamp configured for Reproducible Builds' archive entries, either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXXor as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH.- Parameters:
outputTimestamp- the value of${project.build.outputTimestamp}(may benull)- Returns:
- the parsed timestamp, may be
nullifnullinput or input contains only 1 character - Throws:
IllegalArgumentException- if the outputTimestamp is neither ISO 8601 nor an integer- Since:
- 3.5.0
-
configureReproducible
public Date configureReproducible(String outputTimestamp)
Configure Reproducible Builds archive creation if a timestamp is provided.- Parameters:
outputTimestamp- the value of${project.build.outputTimestamp}(may benull)- Returns:
- the parsed timestamp
- Since:
- 3.5.0
- See Also:
parseOutputTimestamp(java.lang.String)
-
-