Spring Boot Maven构建失败

问题描述 投票:0回答:2

我是maven的新手。但是,我正在尝试使用Gitlab CI Runner进行自动化测试和构建/部署。

我从我的同事那里获得了当前的maven配置。

当作业运行时,它会在几秒钟后失败,并显示以下错误消息:

Downloaded: https://repo.maven.apache.org/maven2/org/springframework/security/spring-security-bom/4.2.3.RELEASE/spring-security-bom-4.2.3.RELEASE.pom (5 KB at 101.0 KB/sec)
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-processor:jar is missing. @ line 20, column 21
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project de.demo:Rest:2.0 (/builds/Dev/Demo/Restv2/pom.xml) has 1 error
[ERROR]     'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-processor:jar is missing. @ line 20, column 21
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
ERROR: Job failed: exit code 1

这是我的春天依赖:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9.RELEASE</version>
</parent>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-processor</artifactId>
        <exclusions>
            <exclusion>
                <groupId>com.vaadin.external.google</groupId>
                <artifactId>android.json</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
</dependencies>

我感谢任何帮助,我找不到我的错误的解决方案:/

非常感谢!

java spring maven
2个回答
2
投票

我想你的意思是

<!-- 
https://mvnrepository.com/artifact/org.springframework.boot/spring-boot
-configuration-processor -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-configuration-processor</artifactId>
</dependency>

不是spring-boot-starter-processor,请在这里查看:https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-configuration-processor/1.5.9.RELEASE


1
投票

看起来你遇到的根本问题是尝试使用不存在的依赖项(来自spring-boot-starter-processororg.springframework.boot)。将依赖项名称修复为父级中实际定义的依赖项名称 - spring-boot-starter-parent也将修复您的“版本”问题。

您看到的错误是说不同的事情(没有定义版本),因为每个maven依赖项需要直接定义版本或在依赖项管理中定义。由于您已将spring-boot-starter-parent设置为父级,因此它为所有有效的依赖项使用依赖性版本。

如果由于任何原因这是一个正确的依赖名称(这将是非常奇怪的),您将通过正确定义版本来修复错误,如:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-processor</artifactId>
    <version>(insert version here)</version>
</dependency>

或通过依赖管理:https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management

© www.soinside.com 2019 - 2024. All rights reserved.