in invoker.properties you will need to specify multiple executions, eg
invoker.goals.1=archetype:generate
invoker.goals.2=verify
the first one generates your project, the second builds it
Sent from my [rhymes with tryPod] ;-)
On 12 Feb 2010, at 01:43, Max Spring <[email protected]> wrote:
This is exactly what I was looking for. Great!
One missing piece: If the instantiated archetype fails to build, I
want the integration test to fail.
So far a failure result is not getting propagated to the "outer"
Maven execution.
I assume this would need to be done as a postBuildHookScript?
Thank you!
-Max
On 2/11/2010 6:13 AM, Luke Patterson wrote:
On Wed, Feb 10, 2010 at 5:37 PM, Max Spring<[email protected]>
wrote:
What would be a good approach to test an archetype project?
...
A minimal test would be to "instantiate" the archetype and to
build the resulting project.
Here's some cut-and-paste that I'm using:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>install</goal>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<cloneProjectsTo>${project.build.directory}/it/projects</
cloneProjectsTo>
<goals>
<goal>org.apache.maven.plugins:maven-archetype-plugin:generate</
goal>
</goals>
<localRepositoryPath>${project.build.directory}/it/repo</
localRepositoryPath>
<pomIncludes>
<pomInclude>*</pomInclude>
</pomIncludes>
<projectsDirectory>${basedir}/src/it/projects</projectsDirectory>
<properties>
<archetypeArtifactId>${project.artifactId}</archetypeArtifactId>
<archetypeGroupId>${project.groupId}</archetypeGroupId>
<archetypeRepository>local</archetypeRepository>
<archetypeVersion>${project.version}</archetypeVersion>
<goals>verify</goals>
<interactiveMode>false</interactiveMode>
</properties>
<streamLogs>true</streamLogs>
</configuration>
</plugin>
then, your archetype will be run during integration-test phase for
all
subdirectories of<projectsDirectory>, a test.properties file will
contain the inputs to the archetype:generate goal, and the verify
phase will be run on each newly generated project
to add a new test, add another directory under<projectsDirectory>
with a test.properties file
------------------------------------------
e.g.
src/it/projects/firsttest/test.properties with contents:
groupId=com.foo
artifactId=firsttest
version=1.0.0
package=com.foo.firsttest
that will create a "firsttest" directory under
${project.build.directory}/it/projects/firsttest with the stuff
generated by your archetype, and then run the verify phase on the
newly generated "com.foo.firsttest" project
------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]