SpringBoot Maven构建失败

时间:2017-12-27 22:45:18

标签: java spring maven

我是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>

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

非常感谢!

2 个答案:

答案 0 :(得分: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 :(得分:1)

看起来您遇到的根问题是尝试使用不存在的依赖项(spring-boot-starter-processor来自org.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

相关问题