Package org.apache.maven.archiver
Class MavenArchiver
java.lang.Object
org.apache.maven.archiver.MavenArchiver
MavenArchiver class.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configureReproducibleBuild
(String outputTimestamp) Configure Reproducible Builds archive creation if a timestamp is provided.void
createArchive
(org.apache.maven.api.Session session, org.apache.maven.api.Project project, MavenArchiveConfiguration archiveConfiguration) createArchive.void
doCreateArchive
(org.apache.maven.api.Session session, org.apache.maven.api.Project project, MavenArchiveConfiguration archiveConfiguration) protected org.codehaus.plexus.archiver.jar.Manifest
doGetManifest
(org.apache.maven.api.Session session, org.apache.maven.api.Project project, ManifestConfiguration config, Map<String, String> entries) org.codehaus.plexus.archiver.jar.JarArchiver
Getter for the fieldarchiver
.org.codehaus.plexus.archiver.jar.Manifest
getManifest
(org.apache.maven.api.Project project, ManifestConfiguration config) Return a pre-configured manifest.org.codehaus.plexus.archiver.jar.Manifest
getManifest
(org.apache.maven.api.Session session, org.apache.maven.api.Project project, ManifestConfiguration config) protected org.codehaus.plexus.archiver.jar.Manifest
getManifest
(org.apache.maven.api.Session session, org.apache.maven.api.Project project, ManifestConfiguration config, Map<String, String> entries) getManifest.org.codehaus.plexus.archiver.jar.Manifest
getManifest
(org.apache.maven.api.Session session, org.apache.maven.api.Project project, MavenArchiveConfiguration config) getManifest.parseBuildOutputTimestamp
(String outputTimestamp) Parse output timestamp configured for Reproducible Builds' archive entries.void
setArchiver
(org.codehaus.plexus.archiver.jar.JarArchiver archiver) Setter for the fieldarchiver
.void
setBuildJdkSpecDefaultEntry
(boolean buildJdkSpecDefaultEntry) Add "Build-Jdk-Spec" entry as part of default manifest entries (true by default).void
setCreatedBy
(String description, String groupId, String artifactId) Define a value for "Created By" entry.void
setOutputFile
(File outputFile) setOutputFile.
-
Field Details
-
SIMPLE_LAYOUT
The simple 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.api.Session session, org.apache.maven.api.Project project, MavenArchiveConfiguration config) throws MavenArchiverException getManifest.
- Parameters:
session
- the Maven Sessionproject
- the Maven Projectconfig
- the MavenArchiveConfiguration- Returns:
- the
Manifest
- Throws:
MavenArchiverException
- in case of a failure
-
getManifest
public org.codehaus.plexus.archiver.jar.Manifest getManifest(org.apache.maven.api.Project project, ManifestConfiguration config) throws MavenArchiverException Return a pre-configured manifest.- Parameters:
project
-Project
config
-ManifestConfiguration
- Returns:
Manifest
- Throws:
MavenArchiverException
- exception.
-
getManifest
public org.codehaus.plexus.archiver.jar.Manifest getManifest(org.apache.maven.api.Session session, org.apache.maven.api.Project project, ManifestConfiguration config) throws MavenArchiverException - Throws:
MavenArchiverException
-
getManifest
protected org.codehaus.plexus.archiver.jar.Manifest getManifest(org.apache.maven.api.Session session, org.apache.maven.api.Project project, ManifestConfiguration config, Map<String, String> entries) throws MavenArchiverExceptiongetManifest.
- Parameters:
session
-Session
project
-Project
config
-ManifestConfiguration
entries
- The entries.- Returns:
Manifest
- Throws:
MavenArchiverException
- exception
-
doGetManifest
protected org.codehaus.plexus.archiver.jar.Manifest doGetManifest(org.apache.maven.api.Session session, org.apache.maven.api.Project project, ManifestConfiguration config, Map<String, String> entries) throws org.codehaus.plexus.archiver.jar.ManifestException- Throws:
org.codehaus.plexus.archiver.jar.ManifestException
-
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.api.Session session, org.apache.maven.api.Project project, MavenArchiveConfiguration archiveConfiguration) throws MavenArchiverException createArchive.
- Parameters:
session
-Session
project
-Project
archiveConfiguration
-MavenArchiveConfiguration
- Throws:
MavenArchiverException
- Archiver Exception.
-
doCreateArchive
public void doCreateArchive(org.apache.maven.api.Session session, org.apache.maven.api.Project project, MavenArchiveConfiguration archiveConfiguration) throws org.codehaus.plexus.archiver.jar.ManifestException, IOException - Throws:
org.codehaus.plexus.archiver.jar.ManifestException
IOException
-
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
-
parseBuildOutputTimestamp
Parse output timestamp configured for Reproducible Builds' archive entries.Either as
DateTimeFormatter.ISO_OFFSET_DATE_TIME
or as a number representing seconds since the epoch (like SOURCE_DATE_EPOCH).- Parameters:
outputTimestamp
- the value of${project.build.outputTimestamp}
(may benull
)- Returns:
- the parsed timestamp as an
Optional<Instant>
,empty
if input isnull
or input contains only 1 character (not a number) - Throws:
IllegalArgumentException
- if the outputTimestamp is neither ISO 8601 nor an integer, or it's not within the valid range 1980-01-01T00:00:02Z to 2099-12-31T23:59:59Z- Since:
- 3.6.0
-
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:
-