Hi,

 

I have an application where surefire-plugin is configured in the parent
pom and child pom, I am giving the code sample below, This results in
tests running twice, if I comment the surefire plugin in the parent pom,
the tests run only once.

 

But I don't want to comment surefire plugin in the parent pom  since
there are various other child modules dependent on that and those tests
will not run, an alternative approach would be that we can write the
surefire plugin in each of the child modules but we want to avoid the
code duplication.

 

Can any one check the sample and tell me if any change can be done to
the configuration to avoid this.

 

Configuration in Parent pom.xml

 

<plugin>

                        <artifactId>maven-surefire-plugin</artifactId>

                        <configuration>

 
<reportsDirectory>../reportsdirectory</reportsDirectory>

                              <excludes>

                                    <exclude>

 
**/JTAManagedTransactionContextTest.java

                                    </exclude>

                              </excludes>

                              <systemProperties>

                                    ...

                              </systemProperties>

                        </configuration>

                  </plugin>

 

Configuration in Child pom.xml

 

<plugin>

                        <artifactId>maven-surefire-plugin</artifactId>

                        <configuration>

                        <skip>true</skip>

                        <testFailureIgnore>true</testFailureIgnore>


                        <systemProperties>

...                   

                          </systemProperties>

                        </configuration>

                        <executions>

                              <execution>

                              <id>unit-test</id>

                                    <phase>test</phase>

                                    <goals>

                                          <goal>test</goal>

                                    </goals>

                                    <configuration>

                                   <skip>false</skip> 

                                          <includes>

                                           <include>

                                              **/*UTest.java

                                           </include>

                                          </includes>


                                    </configuration>

                              </execution>                        

                              <execution>

                              <id>integration-test</id>

                                    <phase>integration-test</phase>

                                    <goals>

                                          <goal>test</goal>

                                    </goals>

                                    <configuration>

                                   <skip>false</skip> 

                                          <includes>

                                           <include>

                                              **/*ITest.java

                                           </include>

                                          </includes>


                                    </configuration>

                              </execution>

                        </executions>

                  </plugin>  

 

Thanks,

 

Raja

 

Reply via email to