mavenpom.xmlmaven-surefire-pluginliquibase-hibernate

I see error with surefire error even though all my test pass, no anwers related to surefire plugin helped me


Recently i migrated surefire plugin from 2.15 to 3.0.0-M5 and i see this below error even though all the test case passed. i dont see anything in report generated, just a empty file. Google nor stackoverflow helped me. Trying this out for almost a week, was not successful. Any idea on this? Any help will appreciated. Thanks

stacktrace details :

INFO: Creating GrizzlyTestContainer configured at thre base eU tReIs httt fpai://lurels.oc

alPlease host:<AVAILABLE-PORT>/
refer to C:\myproject\target\surefire-15:33:40.193 [main] DEBUG org.hibernate.validator.internal.engine.reso
lver.DefaultTraversableResolver - Cannot find javax.persistence.Persistence on classpath. Assuming non JPA 2 environment. All properties will per
default be traversable.
reports for the individual test results.
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_161\jre\bin\java" -jar C:\Users\atest\AppData\Local\Temp\surefire550827656934128985\s
urefirebooter3900377300994647315.jar C:\Users\atest\AppData\Local\Temp\surefire550827656934128985 2020-09-17T15-27-08_835-jvmRun1 surefire826710
7066485510027tmp surefire_05426397409004431606tmp"
Process Exit Code: 0
Crashed tests:
com.ServiceSpec
org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit ca
lled?
Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_161\jre\bin\java" -jar C:\Users\<id>\AppData\Local\Temp\surefire550827656934128985\s
urefirebooter3900377300994647315.jar C:\Users\<id>\AppData\Local\Temp\surefire550827656934128985 2020-09-17T15-27-08_835-jvmRun1 surefire826710
7066485510027tmp surefire_05426397409004431606tmp"
Process Exit Code: 0
Crashed tests:
com.ServiceSpec
        at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:748)
        at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:305)
        at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:265)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1314)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1159)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:932)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execut15:33:40.193 [main] DEBUG org.hibernate.validator.internal.engine.ConfigurationI
mpl - Setting custom ParameterNameProvider of type io.dropwizard.jersey.validation.JerseyParameterNameProvider
e(MojoExecutor.java:156)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)

My pom.xml

   <properties>
        
        <!-- java compiler version -->
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>
        
        <dependency>
            <groupId>org.jdbi</groupId>
            <artifactId>jdbi3-stringtemplate4</artifactId>
            <version>3.9.1</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.jdbi/jdbi3-sqlobject -->
        <dependency>
            <groupId>org.jdbi</groupId>
            <artifactId>jdbi3-sqlobject</artifactId>
            <version>3.9.1</version>
        </dependency>
        <dependency>
            <groupId>org.jdbi</groupId>
            <artifactId>jdbi3-core</artifactId>
            <version>3.9.1</version>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>8.4.1.jre8</version>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.4.196</version>
            <scope>test</scope>
        </dependency>

            <groupId>org.spockframework</groupId>
            <artifactId>spock-core</artifactId>
            <version>1.0-groovy-2.4</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>2.4.3</version>
        </dependency>

        <dependency>
            <groupId>com.microsoft.azure</groupId>
            <artifactId>applicationinsights-web</artifactId>
            <version>2.5.0</version>
        </dependency>


        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>29.0-jre</version>
        </dependency>

        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
            <version>3.10.0</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <testSourceDirectory>${TestSourceDirectory}</testSourceDirectory>
        <testResources>
            <testResource>
                <directory>${TestResourceDirectory}</directory>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.2</version>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                    </execution>
                </executions>
               
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <configuration>
                    <createDependencyReducedPom>true</createDependencyReducedPom>
                    <filters>
                        <filter>
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>META-INF/*.SF</exclude>
                                <exclude>META-INF/*.DSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                            </excludes>
                        </filter>
                    </filters>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/cxf/bus-extensions.txt</resource>
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>someclass</mainClass>
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/hk2-locator/default</resource>
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/kie.conf</resource>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <version>1.11.1-SNAPSHOT</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <complianceLevel>1.8</complianceLevel>
                    <showWeaveInfo>true</showWeaveInfo>
                    <aspectLibraries>
                        <aspectLibrary>
                            <groupId>mygroupid</groupId>
                            <artifactId>utils</artifactId>
                        </aspectLibrary>
                    </aspectLibraries>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <id>jar-with-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/assembly/assembly.xml</descriptor>
                            </descriptors>
                            <tarLongFileMode>posix</tarLongFileMode>
                            <finalName>${project.name}-${project.version}</finalName>
                            <appendAssemblyId>false</appendAssemblyId>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Groovy test compilation -->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <!-- 2.8.0-01 and later require maven-compiler-plugin 3.1 or higher -->
                <version>3.9.0-SNAPSHOT</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <compilerId>groovy-eclipse-compiler</compilerId>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-compiler</artifactId>
                        <version>3.6.0-03</version>
                    </dependency>

                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-batch</artifactId>
                        <version>2.4.3-01</version>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-compiler</artifactId>
                <version>3.6.0-03</version>
                <extensions>true</extensions>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <profile>
            <id>unit</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <TestSourceDirectory>src/test/java</TestSourceDirectory>
                <TestResourceDirectory>src/test/resources</TestResourceDirectory>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>3.0.0-M5</version>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.maven.surefire</groupId>
                                <artifactId>surefire-junit47</artifactId>
                                <version>3.0.0-M5</version>
                            </dependency>
                            <dependency>
                                <groupId>org.apache.maven.surefire</groupId>
                                <artifactId>surefire-testng</artifactId>
                                <version>3.0.0-M5</version>
                            </dependency>
                        </dependencies>
                        <configuration>
                            <includes>
                                <include>**/*.java</include>
                            </includes>
                            <!-- For UTC parallel execution: with below parallel type and thread count, the performance is noticable -->
                            <parallel>classesAndMethods</parallel>
                            <threadCount>2</threadCount>
                            <perCoreThreadCount>true</perCoreThreadCount>
                            <useUnlimitedThreads>false</useUnlimitedThreads>
                            <forkCount>1</forkCount>
                            <reuseForks>true</reuseForks>
                        </configuration>
                    </plugin>
                </plugins>
            </build>

        </profile>
        <profile>
            <id>functional</id>
            <properties>
                <TestSourceDirectory>src/test/functional/java</TestSourceDirectory>
                <TestResourceDirectory>src/test/resources</TestResourceDirectory>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>3.0.0-M5</version>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.maven.surefire</groupId>
                                <artifactId>surefire-testng</artifactId>
                                <version>3.0.0-M5</version>
                            </dependency>
                        </dependencies>
                        <configuration>
                            <includes>
                                <include>**/*.java</include>
                                <!-- needed for Groovy Spock tests -->
                                <include>**/*Spec.*</include>
                            </includes>
                            <argLine>
                                -Xmx1024m
                            </argLine>
                        </configuration>
                    </plugin>
                </plugins>
            </build>

        </profile>

    </profiles>

    <repositories>
        <repository>
            <id>central</id>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <name>releases</name>
            <url>https://myurl</url>
        </repository>
        <repository>
            <id>central-pre-release</id>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <name>prereleases</name>
            <url>https://myurl</url>
        </repository>
    </repositories>

    <distributionManagement>
        <repository>
            <id>central</id>
            <name>Internal Repository</name>
            <url>https://myurl</url>

        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <name>Internal Snapshots</name>
            <url>https://myurl</url>
        </snapshotRepository>

    </distributionManagement>

    <pluginRepositories>
        <pluginRepository>
            <id>snapshot maven dependencies</id>
            <url>https://myurl</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
</project>

Solution

  • Problem was:: surefire was failing to read the errors because its too big and crashing

    Creating logback.xml in /src/test/resources/ fixed this.

    Content of logback.xml is:

    <logger name="org.hibernate" level="warn"/>