简体   繁体   English

在 Maven 项目 (SpringBoot) 中配置 Gitlab CI 时出错

[英]Error configuring Gitlab CI in Maven project (SpringBoot)

I'm actually doing my first project, which uses Gitlab CI & Pipelines.我实际上正在做我的第一个项目,它使用 Gitlab CI & Pipelines。 I'd would like to create a stage which will build the application (and then a test), I tried to follow this tutorial: https://docs.gitlab.com/ee/ci/examples/artifactory_and_gitlab/ but actually I have an error when the pipeline is executed.我想创建一个阶段来构建应用程序(然后是测试),我尝试按照本教程进行操作: https : //docs.gitlab.com/ee/ci/examples/artifactory_and_gitlab/但实际上我有执行管道时出错。

The error that I can't handle is :我无法处理的错误是:

ERROR :错误 :

 [ERROR] [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for GoStyle:GoStyle:1.0-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter:pom:2.1.7.RELEASE from/to UK (http://uk.maven.org/maven2): Transfer failed for http://uk.maven.org/maven2/org/springframework/boot/spring-boot-starter/2.1.7.RELEASE/spring-boot-starter-2.1.7.RELEASE.pom 501 HTTPS Required and 'parent.relativePath' points at wrong local POM @ line 24, column 13

.gitlab-ci.yml : .gitlab-ci.yml :

 image: maven:latest variables: MAVEN_CLI_OPTS: "-s settings.xml --batch-mode" MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository" stages: - build build: stage: build script: - mvn $MAVEN_CLI_OPTS compile

pom.xml : pom.xml :

 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>GoStyle</groupId> <artifactId>GoStyle</artifactId> <version>1.0-SNAPSHOT</version> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>8</source> <target>8</target> </configuration> </plugin> </plugins> </build> <parent> <artifactId>spring-boot-starter</artifactId> <groupId>org.springframework.boot</groupId> <version>2.1.7.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>postgresql</groupId> <artifactId>postgresql</artifactId> <version>9.1-901.jdbc4</version> </dependency> </dependencies> <pluginRepositories> <pluginRepository> <id>repository.spring.release</id> <name>Spring GA Repository</name> <url>https://repo.spring.io/plugins-release/</url> </pluginRepository> </pluginRepositories> </project>

Try adding the repository尝试添加存储库

<repositories>
    <repository>
        <id>spring-releases</id>
        <url>https://repo.spring.io/libs-release</url>
    </repository>
</repositories>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM