Class IntegrationTestMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
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.txtfile, containing a list of goals to run against the generated project (can be empty, content ignored before maven-archetype-plugin 2.1), - an
archetype.propertiesfile, 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
| 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.
- Author:
- rafale
-
Field Summary
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
ConstructorsConstructorDescriptionIntegrationTestMojo(ArchetypeGenerator archetypeGenerator, Downloader downloader, org.apache.maven.shared.invoker.Invoker invoker, ArchetypeGenerationConfigurator archetypeGenerationConfigurator) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbuildInterpolatedFile(File originalFile, File interpolatedFile) voidexecute()Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Constructor Details
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
buildInterpolatedFile
protected void buildInterpolatedFile(File originalFile, File interpolatedFile) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-