Package org.apache.maven.archiver
Class MavenArchiver
java.lang.Object
org.apache.maven.archiver.MavenArchiver
MavenArchiver class.
- Author:
- Emmanuel Venisse, kama
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconfigureReproducible(String outputTimestamp) Deprecated.voidconfigureReproducibleBuild(String outputTimestamp) Configure Reproducible Builds archive creation if a timestamp is provided.voidcreateArchive(org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project, MavenArchiveConfiguration archiveConfiguration) createArchive.org.codehaus.plexus.archiver.jar.JarArchiverGetter for the fieldarchiver.org.codehaus.plexus.archiver.jar.ManifestgetManifest(org.apache.maven.execution.MavenSession mavenSession, org.apache.maven.project.MavenProject project, ManifestConfiguration config) getManifest.protected org.codehaus.plexus.archiver.jar.ManifestgetManifest(org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project, ManifestConfiguration config, Map<String, String> entries) getManifest.org.codehaus.plexus.archiver.jar.ManifestgetManifest(org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project, MavenArchiveConfiguration config) getManifest.org.codehaus.plexus.archiver.jar.ManifestgetManifest(org.apache.maven.project.MavenProject project, ManifestConfiguration config) Return a pre-configured manifest.parseBuildOutputTimestamp(String outputTimestamp) Parse output timestamp configured for Reproducible Builds' archive entries.parseOutputTimestamp(String outputTimestamp) Deprecated.UseparseBuildOutputTimestamp(String)instead.voidsetArchiver(org.codehaus.plexus.archiver.jar.JarArchiver archiver) Setter for the fieldarchiver.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) setOutputFile.
-
Field Details
-
SIMPLE_LAYOUT
The simply layout.- See Also:
-
REPOSITORY_LAYOUT
Repository layout.- See Also:
-
SIMPLE_LAYOUT_NONUNIQUE
simple layout non unique.- See Also:
-
REPOSITORY_LAYOUT_NONUNIQUE
Repository layout non unique.- See Also:
-
-
Constructor Details
-
MavenArchiver
public MavenArchiver()
-
-
Method Details
-
getManifest
public org.codehaus.plexus.archiver.jar.Manifest getManifest(org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project, MavenArchiveConfiguration config) throws org.codehaus.plexus.archiver.jar.ManifestException, org.apache.maven.artifact.DependencyResolutionRequiredException getManifest.
- Parameters:
session- the Maven Sessionproject- the Maven Projectconfig- the MavenArchiveConfiguration- Returns:
- the
Manifest - Throws:
org.codehaus.plexus.archiver.jar.ManifestException- in case of a failureorg.apache.maven.artifact.DependencyResolutionRequiredException- resolution failure
-
getManifest
public org.codehaus.plexus.archiver.jar.Manifest getManifest(org.apache.maven.project.MavenProject project, ManifestConfiguration config) throws org.codehaus.plexus.archiver.jar.ManifestException, org.apache.maven.artifact.DependencyResolutionRequiredException Return a pre-configured manifest.- Parameters:
project-MavenProjectconfig-ManifestConfiguration- Returns:
Manifest- Throws:
org.codehaus.plexus.archiver.jar.ManifestException- Manifest exception.org.apache.maven.artifact.DependencyResolutionRequiredException- Dependency resolution exception.
-
getManifest
public org.codehaus.plexus.archiver.jar.Manifest getManifest(org.apache.maven.execution.MavenSession mavenSession, org.apache.maven.project.MavenProject project, ManifestConfiguration config) throws org.codehaus.plexus.archiver.jar.ManifestException, org.apache.maven.artifact.DependencyResolutionRequiredException getManifest.
- Parameters:
mavenSession-MavenSessionproject-MavenProjectconfig-ManifestConfiguration- Returns:
Manifest- Throws:
org.codehaus.plexus.archiver.jar.ManifestException- the manifest exceptionorg.apache.maven.artifact.DependencyResolutionRequiredException- the dependency resolution required exception
-
getManifest
protected org.codehaus.plexus.archiver.jar.Manifest getManifest(org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project, ManifestConfiguration config, Map<String, String> entries) throws org.codehaus.plexus.archiver.jar.ManifestException, org.apache.maven.artifact.DependencyResolutionRequiredExceptiongetManifest.
- Parameters:
session-MavenSessionproject-MavenProjectconfig-ManifestConfigurationentries- The entries.- Returns:
Manifest- Throws:
org.codehaus.plexus.archiver.jar.ManifestException- the manifest exceptionorg.apache.maven.artifact.DependencyResolutionRequiredException- the dependency resolution required exception
-
getArchiver
public org.codehaus.plexus.archiver.jar.JarArchiver getArchiver()Getter for the field
archiver.- Returns:
JarArchiver
-
setArchiver
public void setArchiver(org.codehaus.plexus.archiver.jar.JarArchiver archiver) Setter for the field
archiver.- Parameters:
archiver-JarArchiver
-
setOutputFile
setOutputFile.
- Parameters:
outputFile- Set output file.
-
createArchive
public void createArchive(org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project, MavenArchiveConfiguration archiveConfiguration) throws org.codehaus.plexus.archiver.jar.ManifestException, IOException, org.apache.maven.artifact.DependencyResolutionRequiredException createArchive.
- Parameters:
session-MavenSessionproject-MavenProjectarchiveConfiguration-MavenArchiveConfiguration- Throws:
org.codehaus.plexus.archiver.ArchiverException- Archiver Exception.org.codehaus.plexus.archiver.jar.ManifestException- Manifest Exception.IOException- IO Exception.org.apache.maven.artifact.DependencyResolutionRequiredException- Dependency resolution exception.
-
setCreatedBy
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
Deprecated.UseparseBuildOutputTimestamp(String)instead.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
Deprecated.UseconfigureReproducibleBuild(String)instead.Configure Reproducible Builds archive creation if a timestamp is provided.- Parameters:
outputTimestamp- the value of${project.build.outputTimestamp}(may benull)- Returns:
- the parsed timestamp as
Date - Since:
- 3.5.0
- See Also:
-
parseBuildOutputTimestamp
Parse output timestamp configured for Reproducible Builds' archive entries.Either as
DateTimeFormatter.ISO_OFFSET_DATE_TIMEor as a number representing seconds since the epoch (like SOURCE_DATE_EPOCH).Since 3.6.4, if not configured or disabled, the
SOURCE_DATE_EPOCHenvironment variable is used as a fallback value, to ease forcing Reproducible Build externally when the build has not enabled it natively in POM.- Parameters:
outputTimestamp- the value of${project.build.outputTimestamp}(may benull)- Returns:
- the parsed timestamp as an
Optional<Instant>,emptyif input isnullor input contains only 1 character (not a number) - Throws:
IllegalArgumentException- if the outputTimestamp is neither ISO 8601 nor an integer.- Since:
- 3.6.0
- See Also:
-
configureReproducibleBuild
Configure Reproducible Builds archive creation if a timestamp is provided.- Parameters:
outputTimestamp- the value ofproject.build.outputTimestamp(may benull)- Since:
- 3.6.0
- See Also:
-
configureReproducibleBuild(String)instead.