简体   繁体   English

无法在项目上执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test):有测试失败

[英]Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project: There are test failures

So I am trying to mvn clean install my spring boot application, but when building I get this error: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project MenuService: There are test failures.所以我正在尝试mvn clean install我的 spring 引导应用程序,但是在构建时出现此错误: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project MenuService: There are test failures. I have temporarily removed all my tests and still get this error and I have tried multiple surefire versions and configurations but no success.我暂时删除了所有测试,但仍然出现此错误,并且我尝试了多个万无一失的版本和配置,但没有成功。 I don't know where to look now and no fix found online is working for me.我现在不知道去哪里找,网上没有找到对我有用的修复方法。

[ERROR] /bin/sh: -c: line 0: unexpected EOF while looking for matching `''
[ERROR] /bin/sh: -c: line 1: syntax error: unexpected end of file
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.784 s
[INFO] Finished at: 2021-12-15T00:40:53+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project MenuService: There are test failures.
[ERROR] 
[ERROR] Please refer to /Users/jovisimons/Documents/school/S3/Mediaan/API's/MenuService/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /Users/jovisimons/Documents/school/S3/Mediaan/API\'s/MenuService && /opt/homebrew/Cellar/openjdk/16.0.2/libexec/openjdk.jdk/Contents/Home/bin/java -jar '/Users/jovisimons/Documents/school/S3/Mediaan/API\'s/MenuService/target/surefire/surefirebooter17156935436656909897.jar' '/Users/jovisimons/Documents/school/S3/Mediaan/API\'s/MenuService/target/surefire' 2021-12-15T00-40-53_468-jvmRun1 surefire13232575194861143290tmp surefire_02848289339630503165tmp

I guess it has something to do with this:我想这与此有关:

 /bin/sh: -c: line 0: unexpected EOF while looking for matching `''
 /bin/sh: -c: line 1: syntax error: unexpected end of file

But I have no clue what it could mean or where to find it.但我不知道它可能意味着什么或在哪里可以找到它。

My pom file:我的 pom 文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.5</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>MenuService</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>MenuService</name>
    <description>MenuService</description>
    <properties>
        <java.version>1.8</java.version>
        <kotlin.version>1.5.21</kotlin.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-kotlin</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-reflect</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-oauth2-resource-server</artifactId>
            <version>5.5.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-oauth2-jose</artifactId>
            <version>5.5.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jdk8</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>5.5.2</version>
            </dependency>
    </dependencies>

    <build>
        <sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
        <testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <dependencies>
                    <dependency>
                        <groupId>org.junit.jupiter</groupId>
                        <artifactId>junit-jupiter-engine</artifactId>
                        <version>5.5.2</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <configuration>
                    <args>
                        <arg>-Xjsr305=strict</arg>
                    </args>
                    <compilerPlugins>
                        <plugin>spring</plugin>
                        <plugin>jpa</plugin>
                    </compilerPlugins>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.jetbrains.kotlin</groupId>
                        <artifactId>kotlin-maven-allopen</artifactId>
                        <version>${kotlin.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.jetbrains.kotlin</groupId>
                        <artifactId>kotlin-maven-noarg</artifactId>
                        <version>${kotlin.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

</project>

FOLDER STRUCTURE文件夹结构

I have found a solution but probably not the best or right one:我找到了解决方案,但可能不是最好或最正确的解决方案:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <forkCount>3</forkCount>
        <reuseForks>true</reuseForks>
        <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
        <testFailureIgnore>true</testFailureIgnore>
    </configuration>
</plugin>

Just comment out the following in the ApplicationTests class:只需在ApplicationTests class中注释掉以下内容:

@Test
    void contextLoads() {
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未能在项目上执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project 无法在项目测试中执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test):未执行任何测试 - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project testing: No tests were executed 获取错误无法在项目上执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) - Getting ERROR Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project 无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) 从命令行运行 Maven 时“无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test (default-test)” - " Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test (default-test)" while running Maven from command line 无法在项目上执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project 无法执行目标org.apache.maven.plugins:maven-surefire-plugin:2.4.3:项目smrr上的test(default-test):测试失败 - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.4.3:test (default-test) on project smrr: There are test failures 无法在项目marytts-lang-en上执行目标org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test(默认测试):存在测试失败 - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project marytts-lang-en: There are test failures 无法在项目myserver上执行目标org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test(默认测试) - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project myserver Intellij - 无法在项目 *** 上执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test):有测试失败 - Intellij - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project *** : There are test failures
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM