gpt4 book ai didi

maven - 即使我所有的测试都通过了,我还是看到了 surefire 错误的错误,没有与 surefire 插件相关的答案帮助我

转载 作者:行者123 更新时间:2023-12-05 04:58:28 26 4
gpt4 key购买 nike

最近我将 surefire 插件从 2.15 迁移到 3.0.0-M5,即使所有测试用例都通过了,我仍然看到下面的错误。我在生成的报告中没有看到任何内容,只是一个空文件。 Google 和 stackoverflow 都没有帮助我。试了将近一个星期,没有成功。对此有什么想法吗?任何帮助将不胜感激。谢谢

堆栈跟踪详细信息:

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)

我的 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>

最佳答案

您必须查看自己的日志。查看您的测试是否使 JVM 执行崩溃:

Crashed tests: com.ServiceSpec

然后查看target/surefire-reports中的转储文件,出现崩溃错误,看到这句话:

Please refer to dump files (if any exist) [date].dump,[date]-jvmRun[N].dump and [date].dumpstream.

如果您使用 JUnit5 并且您的 @BeforeAll 方法失败,则最新版本的 Surefire 将无法通过测试,但不会使其崩溃。

关于maven - 即使我所有的测试都通过了,我还是看到了 surefire 错误的错误,没有与 surefire 插件相关的答案帮助我,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63944487/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com