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 String
REPOSITORY_LAYOUT
Repository layout.static String
REPOSITORY_LAYOUT_NONUNIQUE
Repository layout non unique.static String
SIMPLE_LAYOUT
The simply layout.static String
SIMPLE_LAYOUT_NONUNIQUE
simple layout non unique.
-
Constructor Summary
Constructors Constructor Description MavenArchiver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Date
configureReproducible(String outputTimestamp)
Configure Reproducible Builds archive creation if a timestamp is provided.void
createArchive(MavenSession session, MavenProject project, MavenArchiveConfiguration archiveConfiguration)
JarArchiver
getArchiver()
Manifest
getManifest(MavenSession mavenSession, MavenProject project, ManifestConfiguration config)
protected Manifest
getManifest(MavenSession session, MavenProject project, ManifestConfiguration config, Map<String,String> entries)
Manifest
getManifest(MavenSession session, MavenProject project, MavenArchiveConfiguration config)
Manifest
getManifest(MavenProject project, ManifestConfiguration config)
Return a pre-configured manifest.Date
parseOutputTimestamp(String outputTimestamp)
Parse output timestamp configured for Reproducible Builds' archive entries, either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXX
or as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH.void
setArchiver(JarArchiver archiver)
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)
-
-
-
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
-MavenProject
config
-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
-MavenSession
project
-MavenProject
config
-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
-MavenSession
project
-MavenProject
config
-ManifestConfiguration
entries
- 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
-MavenSession
project
-MavenProject
archiveConfiguration
-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:ssXXX
or 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
null
ifnull
input 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)
-
-