1

J'ai un problème avec le plugin Maven Failsafe qui n'exécute pas mes tests. Le test est stocké dans le dossier \src\test\java\ et son nom est Test1IT.java qui est dans le bon format. De plus, je dois exclure ce test dans le plugin du compilateur Maven, car ce test dépend de l'exécution de la jetée. Voici le pom.xmlLe plugin Maven failsafe n'exécute pas les tests

<plugins> 
     <plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.3</version> 
      <configuration> 
       <source>1.7</source> 
       <target>1.7</target> 
      </configuration> 
      <executions> 
       <execution> 
        <id>default-testCompile</id> 
        <phase>test-compile</phase> 
        <configuration> 
         <testExcludes> 
          <exclude>**/*.java</exclude> 
         </testExcludes> 
        </configuration> 
        <goals> 
         <goal>testCompile</goal> 
        </goals> 
       </execution>     
      </executions> 
</plugin> 

<plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-failsafe-plugin</artifactId> 
      <version>2.19</version> 
      <executions> 
       <execution> 
        <id>integration-test</id> 
        <goals> 
         <goal>integration-test</goal> 
        </goals> 
       </execution> 
       <execution> 
        <id>verify</id> 
        <goals> 
         <goal>verify</goal> 
        </goals> 
       </execution> 
      </executions> 
</plugin> 

Si elle est exécutée mvn verify il construit tout, commencer la jetée et le retour

[INFO] --- maven-failsafe-plugin:2.19:integration-test (integration-test) @ application --- 
[INFO] No tests to run. 

Quel est le problème?

+0

Même si je viens mis en œuvre \t \t \t \t \t \t \t \t \t \t \t **/*. Java \t \t \t \t \t \t \t \t \t et il n'y a toujours pas de test pour courir .. :(Pourriez-vous m'aider? Ceci est un projet multimodule maven – Michal

+0

Si utilisé maven-surefire-plugin ça marche bien. Quel est le problème avec maven failsafe? – Michal

+0

Ni le changement de version ni le changement d'objectif ont aidé comme prévu sur http://stackoverflow.com/questions/4759620/integration-tests-wouldnt-start-failsafe-maven – Michal

Répondre

1

En fait, après plusieurs heures d'expérimentation avec Maven j'ai pu trouver la version de travail:

Voici le fichier pom.xml

<plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.3</version> 
      <configuration> 
       <source>1.7</source> 
       <target>1.7</target> 
      </configuration> 
</plugin> 

<plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-failsafe-plugin</artifactId> 
      <version>2.19</version> 
      <executions> 
       <execution> 
        <id>integration-tests</id> 
        <goals> 
         <goal>integration-test</goal> 
        </goals> 
       </execution> 
      </executions> 
</plugin> 

<plugin> 

      <groupId>org.eclipse.jetty</groupId> 
      <artifactId>jetty-maven-plugin</artifactId> 
      <version>9.2.2.v20140723</version>  
      <configuration> 
       <scanIntervalSeconds>10</scanIntervalSeconds> 
       <stopPort>9966</stopPort> 
       <stopKey>abc</stopKey> 
       <webApp> 
        <contextPath>/hellojavaworld</contextPath>   
       </webApp>  
      </configuration> 
      <executions> 
       <execution> 
        <id>start-jetty</id> 
        <phase>pre-integration-test</phase> 
        <goals> 
         <goal>run-war</goal> 
        </goals> 
        <configuration> 
         <daemon>true</daemon> 
         <scanIntervalSeconds>0</scanIntervalSeconds> 
        </configuration> 
       </execution> 
       <execution> 
        <id>stop-jetty</id> 
        <phase>post-integration-test</phase> 
        <goals> 
         <goal>stop</goal> 
        </goals> 
       </execution> 
      </executions> 
</plugin> 

Soyez prudent sur la version utilisée pour l'extension jetée Maven. Pour mon scénario particulier, la dernière version fonctionnante est 9.2.2.v20140723. Toute version plus récente a un dysfonctionnement. Il commence juste la jetée et le script ne continue pas plus loin. Je ne suis pas sûr que ce soit un bug, mais cela ne devrait pas arriver.

Espérons que ce message aide.