猿问

Java 12 中缺少集成测试阶段

我的任务是使用 Maven 3.0 / Java 8 将项目更新到 Maven 3.6 / Java 12。据我所知,我就是这样做的,更改了各种依赖项。现在,在运行构建时,integration-test似乎缺少该阶段。


例如,在 期间不再调用以下插件clean verify:


<plugin>

    <groupId>com.google.code.maven-replacer-plugin</groupId>

    <artifactId>maven-replacer-plugin</artifactId>

    <version>1.4.1</version>

    <executions>

        <execution>

            <id>do-magic</id>

            <phase>pre-integration-test</phase>

            <goals>

                <goal>replace</goal>

            </goals>

        </execution>

    </executions>

    <configuration>

            <!-- ... -->

    </configuration>

</plugin>

我可以轻松地搜索构建日志do-magic,因此我可以确认它是在 Java 8 中调用的,但不是在 Java 12 中调用的(即使可能还有一些我现在不知道的其他更改)。


调试输出为:


[DEBUG] Goal:          com.google.code.maven-replacer-plugin:maven-replacer-plugin:1.4.1:replace (do-magic)

[DEBUG] Style:         Regular

[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>

<configuration>

    <!-- same as above-->

</configuration>

所以没有关于它为什么不执行的信息。


我尝试integration-test手动调用目标,仍然没有调用插件。也没有额外的信息。


我不知道在哪里寻找问题的根源。我什至不知道在哪里禁用这样的集成测试(除了可能maven.test.skip,它完全从反应器中删除了测试模块,所以不是这样)。


任何人都可以对这个问题有所了解吗?


慕工程0101907
浏览 169回答 1
1回答

慕慕森

问题不在于该integration-test阶段被跳过,而是突然maven-surefire-plugin决定它也想执行测试。那失败了,因为 pre-integration-test测试需要该阶段。我不知道为什么会突然发生这种情况,所以这里有一个伪修复,它再次禁用了 Surefire:<plugin>&nbsp; &nbsp; <artifactId>maven-surefire-plugin</artifactId>&nbsp; &nbsp; <configuration>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <!-- We run integration tests with failsafe! -->&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <skip>true</skip>&nbsp; &nbsp; </configuration></plugin>
随时随地看视频慕课网APP

相关分类

Java
我要回答