在Gitlab CI上无法进行Maven构建

时间:2019-05-30 10:08:28

标签: java maven docker gitlab openjdk-11

我尝试在Gitlab CI上运行单元测试,但由于相同的异常,它们连续失败几次

2019-05-30 07:11:41.820 ERROR 316 --- [           main] org.dbunit.database.DatabaseDataSet      : Table 'tbl_name' not found in tableMap=org.dbunit.dataset.OrderedTableNameMap[_tableNames=[], _tableMap={}, _caseSensitiveTableNames=false]
2019-05-30 07:11:41.821  WARN 316 --- [           main] o.s.test.context.TestContextManager      : Caught exception while invoking 'afterTestMethod' callback on TestExecutionListener [com.github.springtestdbunit.DbUnitTestExecutionListener@29ce22f] for test method [void TestClass.shouldThrowExceptionWhenCashAccountsReachItMaxNumber()] and test instance [TestClass@54af44db]

org.dbunit.dataset.NoSuchTableException: tbl_name
    at org.dbunit.database.DatabaseDataSet.getTableMetaData(DatabaseDataSet.java:305) ~[dbunit-2.6.0.jar:na]
    at org.dbunit.operation.DeleteAllOperation.execute(DeleteAllOperation.java:109) ~[dbunit-2.6.0.jar:na]
    at org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79) ~[dbunit-2.6.0.jar:na]
    at com.github.springtestdbunit.DbUnitRunner.setupOrTeardown(DbUnitRunner.java:183) ~[spring-test-dbunit-1.3.0.jar:na]
    at com.github.springtestdbunit.DbUnitRunner.afterTestMethod(DbUnitRunner.java:92) ~[spring-test-dbunit-1.3.0.jar:na]
    at com.github.springtestdbunit.DbUnitTestExecutionListener.afterTestMethod(DbUnitTestExecutionListener.java:190) ~[spring-test-dbunit-1.3.0.jar:na]
    at org.springframework.test.context.TestContextManager.afterTestMethod(TestContextManager.java:443) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.test.context.junit.jupiter.SpringExtension.afterEach(SpringExtension.java:139) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeAfterEachCallbacks$11(TestMethodTestDescriptor.java:218) ~[junit-jupiter-engine-5.3.2.jar:5.3.2]
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72) ~[junit-platform-engine-1.3.2.jar:1.3.2]
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeAllAfterMethodsOrCallbacks$13(TestMethodTestDescriptor.java:230) ~[junit-jupiter-engine-5.3.2.jar:5.3.2]
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1540) ~[na:na]

这是.gitlab-ci.yaml

image: maven:3.6.0-jdk-11-slim

variables:
  MAVEN_OPTS: "-Dmaven.repo.local=/cache/.m2"

build:
  script: "mvn clean install -B"

我的本​​地配置

C:\workspace>mvn -v
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T22:00:29+03:00)
Maven home: C:\tools\apache-maven-3.6.1\bin\..
Java version: 11.0.2, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-11.0.2
Default locale: en_US, platform encoding: Cp1251
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

我尝试在本地运行该docker映像(maven:3.6.0-jdk-11-slim),还尝试了版本maven:3.6.1-jdk-11,但都失败了

然后我发现本地有Open JDK 11.0.2,而docker image使用Open JDK 11.0.3 https://github.com/docker-library/openjdk/blob/1733ab9061cf1a076dc0566e40edb600fc434db4/11/jdk/slim/Dockerfile

也许有人知道可能是什么问题?

0 个答案:

没有答案