1

我试图在测试期间在我的 Spring Boot 应用程序中运行 Blockhound。不幸的是,gradle 没有选择所需的-XX:+AllowRedefinitionToAddDeleteMethods标志。我在 Run Configurations 和 gradle.properties 中使用 IntelliJ 的 VMoptions 进行了尝试org.gradle.jvmargs=-XX:+AllowRedefinitionToAddDeleteMethods。错误仍然存​​在。

4

1 回答 1

0

这行得通吗?

摇篮:

tasks.withType(Test).all {
        if (JavaVersion.current().isCompatibleWith​(JavaVersion.VERSION_15)) {
            jvmArgs += [
                    "-XX:+AllowRedefinitionToAddDeleteMethods"
            ]
        }
    }

行家:

<plugins>
 ...
         <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-surefire-plugin</artifactId>
             <version>2.22.2</version>
             <configuration>
                 <argLine>-XX:+AllowRedefinitionToAddDeleteMethods</argLine>
             </configuration>
         </plugin>
 ...
 </plugins>

还是 JAVA_OPTS?在 Mac/Linux 上:

export JAVA_OPTS="-XX:+AllowRedefinitionToAddDeleteMethods"

或窗户

set JAVA_OPTS="-XX:+AllowRedefinitionToAddDeleteMethods"

参考:https ://github.com/reactor/BlockHound/issues/33

于 2021-06-04T14:06:20.553 回答