How to change the life cycle of the Maven?

Asked

Viewed 39 times

2

I have an EJB project and would like to run the test after deploying my Air. Because I have a test on the ejb layer, which needs to access the ejbstubs inside the server(was), before I did it with ant, but I’m switching to Maven, but I’m not managing to change the life cycle.

  • Why not use the Arquillian?

  • 1

    Have you tried putting a simple test into the src/test/java folder? The default Maven lifecycle already runs the Junit tests that are in this folder when you invoke clean install, for example.

1 answer

1


It is possible yes, you can configure the surefire plugin:

<build>
...

<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.15</version>
    <configuration>
      <excludes>
        <exclude>**/integration/*.java</exclude>
      </excludes>
   </configuration>
   <executions>
     <execution>
        <id>integration-test</id>
        <goals>
          <goal>test</goal>
        </goals> 
        <phase>integration-test</phase>
        <configuration>
          <excludes>
            <exclude>none</exclude>
          </excludes>
          <includes>
            <include>**/integration/*.java</include>
          </includes>
        </configuration>
      </execution>
    </executions>
  </plugin>
</plugins>

Source and more information: Integrated Testing

Browser other questions tagged

You are not signed in. Login or sign up in order to post.