Class IntegrationTestMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.archetype.mojos.IntegrationTestMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="integration-test", requiresProject=true) public class IntegrationTestMojo extends org.apache.maven.plugin.AbstractMojoExecute 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/projectscontaining:- 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.propertiesfile in the parent directory, specifying the archetype'sgroupId,artifactIdandversionalong with itsarchetype.propertiesfile, 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/it1Directory for integration test 1 src/test/resources/projects/it1/archetype.pom.propertiesGAV for the archetype from which to generate the parent src/test/resources/projects/it1/archetype.propertiesAll required properties for the archetype being specified by archetype.pom.propertieson this levelsrc/test/resources/projects/it1/childDirectory for maven module within integration test 1 (this folder's name is not relevant) src/test/resources/projects/it1/child/goal.txtThe file containing the list of goals to be executed against the generated project src/test/resources/projects/it1/child/archetype.propertiesAll required properties for this project's archetype Notice that it is expected to be run as part as of a build after the
packagephase and not directly as a goal from CLI.- Author:
- rafale
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.maven.artifact.repository.ArtifactRepositorylocalRepositoryprotected java.util.List<org.apache.maven.artifact.repository.ArtifactRepository>remoteRepositories
-
Constructor Summary
Constructors Constructor Description IntegrationTestMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbuildInterpolatedFile(java.io.File originalFile, java.io.File interpolatedFile)voidexecute()
-
-
-
Field Detail
-
remoteRepositories
@Parameter(defaultValue="${project.remoteArtifactRepositories}", readonly=true, required=true) protected java.util.List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories
-
localRepository
@Parameter(defaultValue="${localRepository}", readonly=true, required=true) protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
buildInterpolatedFile
protected void buildInterpolatedFile(java.io.File originalFile, java.io.File interpolatedFile) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
-