Java 如果没有至少一个TestEngine,则无法创建启动器,PremissionViolationException

Java 如果没有至少一个TestEngine,则无法创建启动器,PremissionViolationException,java,spring,junit5,Java,Spring,Junit5,我想在应用程序启动时运行所有测试。但我得到: 线程“main”org.junit.platform.commons.util.PremissionViolationException中出现异常:如果没有至少一个TestEngine,则无法创建启动器;考虑将引擎实现jar添加到类路径< /p> 已尝试将surefire插件添加到插件部分。还尝试了一些不同的junit版本。。。没有任何帮助 <parent> <groupId>org.springframewo

我想在应用程序启动时运行所有测试。但我得到: 线程“main”org.junit.platform.commons.util.PremissionViolationException中出现异常:如果没有至少一个TestEngine,则无法创建启动器;考虑将引擎实现jar添加到类路径< /p> 已尝试将surefire插件添加到插件部分。还尝试了一些不同的junit版本。。。没有任何帮助

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.6.RELEASE</version>
    </parent>
    <packaging>jar</packaging>
    <dependencies>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.5</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>com.jayway.restassured</groupId>
            <artifactId>json-path</artifactId>
            <version>2.4.0</version>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.4.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apiguardian</groupId>
            <artifactId>apiguardian-api</artifactId>
            <version>1.0.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <version>1.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.4.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <version>9.0.17</version>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-surefire-provider</artifactId>
            <version>1.3.2</version>
            <scope>test</scope>
        </dependency>


    </dependencies>

    <properties>
        <java.version>1.8</java.version>
        <junit-jupiter.version>5.4.0</junit-jupiter.version>
        <junit.platform.version>1.3.2</junit.platform.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19</version>
                <dependencies>
                    <dependency>
                        <groupId>org.junit.platform</groupId>
                        <artifactId>junit-platform-surefire-provider</artifactId>
                        <version>1.3.2</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

org.springframework.boot
spring启动程序父级
2.1.6.1发布
罐子
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
弹簧起动试验
测试
com.jayway.jsonpath
json路径
测试
com.google.code.gson
格森
2.8.5
log4j
log4j
1.2.17
com.jayway.restassed
json路径
2.4.0
org.junit.jupiter
朱尼特木星发动机
5.4.0
测试
org.apigardian
卫报api
1.0.0
编译
org.junit.platform
junit平台发射器
1.2.0
org.junit.jupiter
JUnitJupiter api
5.4.0
编译
jstl
jstl
1.2
org.apache.tomcat.embed
汤姆卡特·贾斯珀
9.0.17
org.junit.platform
junit平台surefire提供程序
1.3.2
测试
1.8
5.4.0
1.3.2
maven编译器插件
3.1
${java.version}
${java.version}
maven surefire插件
2.19
org.junit.platform
junit平台surefire提供程序
1.3.2
org.springframework.boot
springbootmaven插件
试图添加:

<dependency>
    <groupId>org.jetbrains.spek</groupId>
    <artifactId>spek-junit-platform-engine</artifactId>
    <version>1.0.89</version>
    <scope>test</scope>
</dependency>

org.jetbrains.spek
spek junit平台引擎
1.0.89
测试

也没有帮助

您仅在测试范围内添加Jupiter。您的应用程序可能在运行时/编译范围内需要它。可能与中的已尝试解决方案重复,但不起作用