Max Spring wrote:
> 
> 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.
> 

Hmm, I didn't know archetype would ignore failures, I pasted another
solution below.


Stephen Connolly-2 wrote:
> 
> 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
> 

I think that setup will be "off by one".  It will run "verify" on the
folders that just have "test.properties" in them, not one more level deep
which contains the generated projects.

But a setup like this should work:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-invoker-plugin</artifactId>
  <executions>
    <execution>
      <id>generate-projects</id>
      <goals>
        <goal>install</goal>
        <goal>run</goal>
      </goals>
      <configuration>
       
<cloneProjectsTo>${project.build.directory}/it/projects</cloneProjectsTo>
        <goals>
         
<goal>org.apache.maven.plugins:maven-archetype-plugin:generate</goal>
        </goals>
        <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>
          <interactiveMode>false</interactiveMode>
        </properties>
      </configuration>
    </execution>
    <execution>
      <id>verify-projects</id>
      <goals>
        <goal>run</goal>
      </goals>
      <configuration>
        <goals>
          <goal>verify</goal>
        </goals>
        <pomIncludes>
          <pomInclude>*/*/pom.xml</pomInclude>
        </pomIncludes>
       
<projectsDirectory>${project.build.directory}/it/projects</projectsDirectory>
      </configuration>
    </execution>
  </executions>
  <configuration>
   
<localRepositoryPath>${project.build.directory}/it/repo</localRepositoryPath>
    <streamLogs>true</streamLogs>
  </configuration>
</plugin>

-- 
View this message in context: 
http://old.nabble.com/unit-testing-archetypes-tp27544824p27564451.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to