小编Ben*_* Li的帖子

升级到 JDK 8 后,maven Surefire 测试失败

我有多模块项目。我所有的测试都是在 JDK 7 下通过的。但是当我升级到 JDK 8 时,maven Surefire 运行了两次(它在 JDK 7 中也运行了两次)。第一次测试通过了,但第二次测试失败了。

我已经尝试升级最新的肯定会成功但没有运气。

有谁知道如何解决这个问题?

父.pom

    <pluginManagement>
        <plugins>
            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
                <fork>true</fork>
                <source>${source.level}</source>
                <target>${target.level}</target>
                <testSource>${source.level}</testSource>
                <testTarget>${target.level}</testTarget>
                <showWarnings>true</showWarnings>
                <showDeprecation>true</showDeprecation>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.18.1</version>
            <configuration>
                <argLine>-Xms512m -Xmx1024m
                    </argLine>

            </configuration>
        </plugin>
            <!--This plugin's configuration is used to store Eclipse m2e settings 
                only. It has no influence on the Maven build itself. -->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>
                                        org.apache.maven.plugins
                                    </groupId>
                                    <artifactId>
                                        maven-antrun-plugin
                                    </artifactId>
                                    <versionRange>
                                        [1.3,)
                                    </versionRange> …
Run Code Online (Sandbox Code Playgroud)

maven maven-surefire-plugin java-8

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

java-8 ×1

maven ×1

maven-surefire-plugin ×1