Hello, Maven gurus,

We run into something very bizarre when trying to run some unit tests that use a embedded jetty server with surefire and cobertura. It works well with our original configuration like

<build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
                    <configuration>
                        <skip>${maven.test.skip}</skip>
                        <check>
                            <branchRate>30</branchRate>
                            <lineRate>30</lineRate>
<haltOnFailure>true</haltOnFailure>
<totalBranchRate>55</totalBranchRate>
<totalLineRate>55</totalLineRate>
<packageLineRate>50</packageLineRate>
<packageBranchRate>50</packageBranchRate>
                        </check>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>clean</goal>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <warName>cxf</warName>
                </configuration>
            </plugin>
            <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>install</id>
                        <phase>install</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
                <configuration>
<argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=512m</argLine>
<junitArtifactName>junit:junit</junitArtifactName>
                    <includes>
                        <include>**/*UnitTest*</include>
<include>**/*JettyTest*</include>
                    </includes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
                <version>2.0</version>
            </plugin>
        </plugins>
        <extensions>
            <extension>
<groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh</artifactId>
                <version>1.0-beta-6</version>
            </extension>
        </extensions>
    </build>


But when I tried to separate the running of UnitTest and JettyTest like the following, so UnitTest are run all the time and JettyTests are only run in a specific profile,

    <build>
        <pluginManagement>
            <plugins>
<!-- surefire stays here or it overrides the definition in profiles -->
                <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
<argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=512m</argLine>
<junitArtifactName>junit:junit</junitArtifactName>
                        <includes>
<include>**/*UnitTest*</include>
                        </includes>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <warName>cxf</warName>
                </configuration>
            </plugin>
            <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>install</id>
                        <phase>install</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
                <version>2.0</version>
            </plugin>
        </plugins>
        <extensions>
            <extension>
<groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh</artifactId>
                <version>1.0-beta-6</version>
            </extension>
        </extensions>
    </build>

and get the JettyTest and Cobertura in a profile called all-test

<profiles>
        <profile>
            <id>all-test</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
                            <configuration>
<argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=512m</argLine>
<junitArtifactName>junit:junit</junitArtifactName>
                                <includes>
<include>**/*UnitTest*</include>
<include>**/*JettyTest*</include>
                                </includes>
                            </configuration>
                        </plugin>
                        <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
                            <configuration>
<skip>${maven.test.skip}</skip>
<check>
<branchRate>30</branchRate>
<lineRate>30</lineRate>
<haltOnFailure>true</haltOnFailure>
<totalBranchRate>55</totalBranchRate>
<totalLineRate>55</totalLineRate>
<packageLineRate>50</packageLineRate>
<packageBranchRate>50</packageBranchRate>
                                </check>
                            </configuration>
                            <executions>
                                <execution>
                                    <goals>
<goal>clean</goal>
<goal>check</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>

It runs fine in my centos 5.5 x86_64. But if I submit it to centos 5.7 x86_64, jetty tests are giving me all kinds of errors, like the jetty server cannot be initiated right. But with the original configuration, jetty tests are OK. I'm so confused. Totally out of clues. Can any one please give me some hint/insights? Anything would be deeply appreciated

Reply via email to