jar:test-jar

Full name:

org.apache.maven.plugins:maven-jar-plugin:2.6:test-jar

Description:

Build a JAR of the test classes for the current project.

Attributes:

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

Required Parameters

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

Optional Parameters

Name Type Since Description
archive MavenArchiveConfiguration - The archive configuration to use. See Maven Archiver Reference.
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.
finalName String - Name of the generated JAR.
Default value is: ${project.build.finalName}.
User property is: jar.finalName.
forceCreation boolean - Require the jar plugin to build a new JAR even if none of the contents appear to have changed. By default, this plugin looks to see if the output jar exists and inputs have not changed. If these conditions are true, the plugin skips creation of the jar. This does not work when other plugins, like the maven-shade-plugin, are configured to post-process the jar. This plugin can not detect the post-processing, and so leaves the post-processed jar in place. This can lead to failures when those plugins do not expect to find their own output as an input. Set this parameter to true to avoid these problems by forcing this plugin to recreate the jar every time.
Default value is: false.
User property is: jar.forceCreation.
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.
skip boolean - Set this to true to bypass unit tests entirely. Its use is NOT RECOMMENDED, but quite convenient on occasion.
User property is: maven.test.skip.
skipIfEmpty boolean - Skip creating empty archives
Default value is: false.
User property is: jar.skipIfEmpty.
useDefaultManifestFile boolean 2.2 Set this to true to enable the use of the defaultManifestFile.
Default value is: false.
User property is: jar.useDefaultManifestFile.

Parameter Details

archive:

The archive configuration to use. See Maven Archiver Reference.
  • Type: org.apache.maven.archiver.MavenArchiveConfiguration
  • 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: No
  • User Property: jar.finalName
  • Default: ${project.build.finalName}

forceCreation:

Require the jar plugin to build a new JAR even if none of the contents appear to have changed. By default, this plugin looks to see if the output jar exists and inputs have not changed. If these conditions are true, the plugin skips creation of the jar. This does not work when other plugins, like the maven-shade-plugin, are configured to post-process the jar. This plugin can not detect the post-processing, and so leaves the post-processed jar in place. This can lead to failures when those plugins do not expect to find their own output as an input. Set this parameter to true to avoid these problems by forcing this plugin to recreate the jar every time.
  • Type: boolean
  • Required: No
  • User Property: 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}

skip:

Set this to true to bypass unit tests entirely. Its use is NOT RECOMMENDED, but quite convenient on occasion.
  • Type: boolean
  • Required: No
  • User Property: maven.test.skip

skipIfEmpty:

Skip creating empty archives
  • Type: boolean
  • Required: No
  • User Property: jar.skipIfEmpty
  • Default: false

testClassesDirectory:

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

useDefaultManifestFile:

Set this to true to enable the use of the defaultManifestFile.
  • Type: boolean
  • Since: 2.2
  • Required: No
  • User Property: jar.useDefaultManifestFile
  • Default: false