java GItLab CI - Maven run test disabled tests with JUnit 5

rmbxnbpk  于 2023-11-15  发布在  Java
关注(0)|答案(1)|浏览(87)

我尝试在GitLab上运行CI管道,但maven的目标“test”始终失败。Maven通过@Disable annotation运行禁用的测试。这测试了尚未实现的功能,并且正如预期的那样,在运行后失败。
管线.gitlab-ci.yml

variables:
  MAVEN_OPTS: >-
    -Dhttps.protocols=TLSv1.2
    -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository
    -Dorg.slf4j.simpleLogger.showDateTime=true
  MAVEN_CLI_OPTS: >-
    --batch-mode
    --no-transfer-progress
    --fail-at-end

image: maven:3-openjdk-17

cache:
  paths:
    - .m2/repository

Test job:
  stage: test
  script:
    - 'mvn $MAVEN_CLI_OPTS test'
  allow_failure: true

字符串
pom.xml中的密度:

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>3.1.4</version>
      <scope>import</scope>
      <type>pom</type>
    </dependency>
  </dependencies>
</dependencyManagement>

<dependencies>
  ...
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <exclusions>
      <exclusion>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
      </exclusion>
    </exclusions>
    <scope>test</scope>
  </dependency>
  ...
</dependencies>

<build>
  <plugins>
      ...
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>3.1.2</version>
    </plugin>
    ...
  <plugins>
<build>


一切都适用于本地mvn test
我试图删除--fail-at-end forMAVEN_CLI_OPTS,但没有改变。

mrphzbgm

mrphzbgm1#

只需要在管道设置中替换图像标签。

之前:image: maven:3-openjdk-17
后:image: maven:3.8.3-openjdk-17

相关问题