【发布时间】:2022-10-24 16:03:17
【问题描述】:
我们的应用程序基于传统的 spring boot 1 和 tomcat 7 构建。我们有 2 种类型的测试套件 - Junits(Java)和集成测试(用 Groovy 编写)。我们使用下面的插件来编译我们的常规测试。
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.2</version>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovyVersion}</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<!-- testGenerateStubs allows us to reference Groovy classes from Java tests -->
<goal>testGenerateStubs</goal>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<testSources>
<testSource>
<directory>src/test/groovy</directory>
</testSource>
<testSource>
<directory>src/test-integration/java</directory>
<directory>src/test-integration/groovy</directory>
</testSource>
</testSources>
</configuration>
</plugin>
我们最近对 Spring Boot 2.7.1 进行了重大升级,并正在删除不推荐使用的方法 - 代码重构等。我们几乎完成了它,但直到今天才发现 gmavenplus-plugin 的目标“testCompile”存在问题。它抛出错误。
[INFO] --- gmavenplus-plugin:1.2:testCompile (default)
[INFO] Using Groovy 2.4.6 to perform testCompile.
[INFO] BUILD FAILURE
[ERROR] Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.2:testCompile (default) on project trta-tds: Error occurred while calling a method on a Groovy class from classpath.: InvocationTargetException: Unable to load class org.springframework.mock.web.MockHttpServletRequest due to missing dependency javax/servlet/http/HttpUpgradeHandler
我们怀疑这可能是 tomcat 7 的问题,但我们再次没有看到 tomcat 被用于“testCompile”目标。我们的时间紧迫。请让我们知道您的建议/解决方案。
【问题讨论】:
标签: java spring spring-boot maven groovy