简体   繁体   中英

Error configuring Gitlab CI in Maven project (SpringBoot)

I'm actually doing my first project, which uses 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.

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 :

 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 :

 <?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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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