Fork me on GitHub

archetype:integration-test

Full name:

org.apache.maven.plugins:maven-archetype-plugin:3.2.1:integration-test

Description:

Execute the archetype integration tests, consisting in generating projects from the current archetype and optionally comparing generated projects with reference copy.

Each IT consists of a sub-directory in src/test/resources/projects containing:

  • a goal.txt file, containing a list of goals to run against the generated project (can be empty, content ignored before maven-archetype-plugin 2.1),
  • an archetype.properties file, containing properties for project generation,
  • an optional reference/ directory containing a reference copy of the expected project created from the IT.

To let the IT create a Maven module below some other Maven project (being generated from another archetype) one can additionally specify an optional archetype.pom.properties file in the parent directory, specifying the archetype's groupId, artifactId and version along with its archetype.properties file, containing properties for project generation. Both files are leveraged to create the parent project for this IT. Parent projects can be nested.

An example structure for such an integration test looks like this

integration test folder structure
File/Directory Description
src/test/resources/projects/it1 Directory for integration test 1
src/test/resources/projects/it1/archetype.pom.properties GAV for the archetype from which to generate the parent
src/test/resources/projects/it1/archetype.properties All required properties for the archetype being specified by archetype.pom.properties on this level
src/test/resources/projects/it1/child Directory for maven module within integration test 1 (this folder's name is not relevant)
src/test/resources/projects/it1/child/goal.txt The file containing the list of goals to be executed against the generated project
src/test/resources/projects/it1/child/archetype.properties All required properties for this project's archetype

Notice that it is expected to be run as part as of a build after the package phase and not directly as a goal from CLI.

Attributes:

  • Requires a Maven project to be executed.

Required Parameters

Name Type Since Description
<localRepositoryPath> File 2.2 The local repository to run maven instance.
Default value is: ${settings.localRepository}.
User property is: archetype.test.localRepositoryPath.
<testProjectsDirectory> File 2.2 Directory of test projects
Default value is: ${project.build.testOutputDirectory}/projects.
User property is: archetype.test.projectsDirectory.

Optional Parameters

Name Type Since Description
<debug> boolean 2.2 Whether to show debug statements in the build output.
Default value is: false.
User property is: archetype.test.debug.
<encoding> String 2.2 The file encoding for the post-build script.
Default value is: ${project.build.sourceEncoding}.
User property is: encoding.
<filterProperties> Map 2.2 A list of additional properties which will be used to filter tokens in settings.xml
<ignoreEOLStyle> boolean 2.3 Ignores the EOL encoding for comparing files (default and original behaviour is false).
Default value is: false.
User property is: archetype.test.ignoreEOLStyle.
<noLog> boolean 2.2 Suppress logging to the build.log file.
Default value is: false.
User property is: archetype.test.noLog.
<postBuildHookScript> String 2.2 Relative path of a cleanup/verification hook script to run after executing the build. This script may be written with either BeanShell or Groovy. If the file extension is omitted (e.g. verify), the plugin searches for the file by trying out the well-known extensions .bsh and .groovy. If this script exists for a particular project but returns any non-null value different from true or throws an exception, the corresponding build is flagged as a failure.
Default value is: verify.
User property is: archetype.test.verifyScript.
<properties> Map 3.0.2 Common set of properties to pass in on each project's command line, via -D parameters.
<settingsFile> File 2.2 Path to an alternate settings.xml to use for Maven invocation with all ITs. Note that the <localRepository> element of this settings file is always ignored, i.e. the path given by the parameter localRepositoryPath is dominant.
User property is: archetype.test.settingsFile.
<showVersion> boolean 2.2 flag to enable show mvn version used for running its (cli option : -V,--show-version )
Default value is: false.
User property is: archetype.test.showVersion.
<skip> boolean - Skip the integration test.
User property is: archetype.test.skip.
<streamLogs> boolean 2.2 Flag used to determine whether the build logs should be output to the normal mojo log.
Default value is: true.
User property is: archetype.test.streamLogs.

Parameter Details

<debug>

Whether to show debug statements in the build output.
  • Type: boolean
  • Since: 2.2
  • Required: No
  • User Property: archetype.test.debug
  • Default: false

<encoding>

The file encoding for the post-build script.
  • Type: java.lang.String
  • Since: 2.2
  • Required: No
  • User Property: encoding
  • Default: ${project.build.sourceEncoding}

<filterProperties>

A list of additional properties which will be used to filter tokens in settings.xml
  • Type: java.util.Map
  • Since: 2.2
  • Required: No

<ignoreEOLStyle>

Ignores the EOL encoding for comparing files (default and original behaviour is false).
  • Type: boolean
  • Since: 2.3
  • Required: No
  • User Property: archetype.test.ignoreEOLStyle
  • Default: false

<localRepositoryPath>

The local repository to run maven instance.
  • Type: java.io.File
  • Since: 2.2
  • Required: Yes
  • User Property: archetype.test.localRepositoryPath
  • Default: ${settings.localRepository}

<noLog>

Suppress logging to the build.log file.
  • Type: boolean
  • Since: 2.2
  • Required: No
  • User Property: archetype.test.noLog
  • Default: false

<postBuildHookScript>

Relative path of a cleanup/verification hook script to run after executing the build. This script may be written with either BeanShell or Groovy. If the file extension is omitted (e.g. verify), the plugin searches for the file by trying out the well-known extensions .bsh and .groovy. If this script exists for a particular project but returns any non-null value different from true or throws an exception, the corresponding build is flagged as a failure.
  • Type: java.lang.String
  • Since: 2.2
  • Required: No
  • User Property: archetype.test.verifyScript
  • Default: verify

<properties>

Common set of properties to pass in on each project's command line, via -D parameters.
  • Type: java.util.Map
  • Since: 3.0.2
  • Required: No

<settingsFile>

Path to an alternate settings.xml to use for Maven invocation with all ITs. Note that the <localRepository> element of this settings file is always ignored, i.e. the path given by the parameter localRepositoryPath is dominant.
  • Type: java.io.File
  • Since: 2.2
  • Required: No
  • User Property: archetype.test.settingsFile

<showVersion>

flag to enable show mvn version used for running its (cli option : -V,--show-version )
  • Type: boolean
  • Since: 2.2
  • Required: No
  • User Property: archetype.test.showVersion
  • Default: false

<skip>

Skip the integration test.
  • Type: boolean
  • Required: No
  • User Property: archetype.test.skip

<streamLogs>

Flag used to determine whether the build logs should be output to the normal mojo log.
  • Type: boolean
  • Since: 2.2
  • Required: No
  • User Property: archetype.test.streamLogs
  • Default: true

<testProjectsDirectory>

Directory of test projects
  • Type: java.io.File
  • Since: 2.2
  • Required: Yes
  • User Property: archetype.test.projectsDirectory
  • Default: ${project.build.testOutputDirectory}/projects