我在GitLab管道中使用. GitLab -ci运行selenium cucumber项目时遇到以下错误:yml配置
[ERROR] Failed to execute goal on project Samplemaven: Could not resolve dependencies for project org.example:Samplemaven:jar:1.0-SNAPSHOT: Failed to collect dependencies at io.cucumber:cucumber-java:jar:7.2.3: Failed to read artifact descriptor for io.cucumber:cucumber-java:jar:7.2.3: Could not transfer artifact io.cucumber:cucumber-java:pom:7.2.3 from/to central (http://repo.maven.apache.org/maven2): Connection reset -> [Help 1]
要在GitLab中运行selenium cucumber项目,我们需要设置这个. GitLab -ci。根目录下的Yml文件。在.gitlab-ci中使用下面的配置。yml文件。
image: maven:3.8.3-openjdk-17
cache:
paths:
- .m2/repository/
- target/
build:
stage: build
script:
- mvn compile
test:
stage: test
script:
- pwd
- mvn test
确保在pom.xml文件中使用了下面的插件,
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>8</source>
<target>8</target>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<configuration>
<includes>
<include>**/RunCukes*.java</include><!-- specify your runner file here -->
</includes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
注意:在本地IDE中运行pom.xml作为maven测试时,它应该触发cucumber runner文件