jar:jar

Full name:

org.apache.maven.plugins:maven-jar-plugin:2.4:jar

Description:

Build a JAR from the current project.

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: runtime.
  • The goal is thread-safe and supports parallel builds.
  • Binds by default to the lifecycle phase: package.

Required Parameters

Name Type Since Description
classesDirectory File - Directory containing the classes and resource files that should be packaged into the JAR.
Default value is: ${project.build.outputDirectory}.
finalName String - Name of the generated JAR.
Default value is: ${project.build.finalName}.
outputDirectory File - Directory containing the generated JAR.
Default value is: ${project.build.directory}.

Optional Parameters

Name Type Since Description
archive MavenArchiveConfiguration - The archive configuration to use. See Maven Archiver Reference.
classifier String - Classifier to add to the artifact generated. If given, the artifact will be attached. If this is not given,it will merely be written to the output directory according to the finalName.
excludes String[] - List of files to exclude. Specified as fileset patterns which are relative to the input directory whose contents is being packaged into the JAR.
forceCreation boolean - Whether creating the archive should be forced.
Default value is: false.
includes String[] - List of files to include. Specified as fileset patterns which are relative to the input directory whose contents is being packaged into the JAR.
skipIfEmpty boolean - Skip creating empty archives
Default value is: false.
useDefaultManifestFile boolean 2.2 Set this to true to enable the use of the defaultManifestFile.
Default value is: false.

Parameter Details

archive:

The archive configuration to use. See Maven Archiver Reference.
  • Type: org.apache.maven.archiver.MavenArchiveConfiguration
  • Required: No

classesDirectory:

Directory containing the classes and resource files that should be packaged into the JAR.
  • Type: java.io.File
  • Required: Yes
  • Default: ${project.build.outputDirectory}

classifier:

Classifier to add to the artifact generated. If given, the artifact will be attached. If this is not given,it will merely be written to the output directory according to the finalName.
  • Type: java.lang.String
  • Required: No

excludes:

List of files to exclude. Specified as fileset patterns which are relative to the input directory whose contents is being packaged into the JAR.
  • Type: java.lang.String[]
  • Required: No

finalName:

Name of the generated JAR.
  • Type: java.lang.String
  • Required: Yes
  • Expression: ${jar.finalName}
  • Default: ${project.build.finalName}

forceCreation:

Whether creating the archive should be forced.
  • Type: boolean
  • Required: No
  • Expression: ${jar.forceCreation}
  • Default: false

includes:

List of files to include. Specified as fileset patterns which are relative to the input directory whose contents is being packaged into the JAR.
  • Type: java.lang.String[]
  • Required: No

outputDirectory:

Directory containing the generated JAR.
  • Type: java.io.File
  • Required: Yes
  • Default: ${project.build.directory}

skipIfEmpty:

Skip creating empty archives
  • Type: boolean
  • Required: No
  • Expression: ${jar.skipIfEmpty}
  • Default: false

useDefaultManifestFile:

Set this to true to enable the use of the defaultManifestFile.
  • Type: boolean
  • Since: 2.2
  • Required: No
  • Expression: ${jar.useDefaultManifestFile}
  • Default: false