简体   繁体   中英

SpringBoot Maven build fails

I'm new to maven. However, I'm trying to use Gitlab CI Runner for automated testing and building / deployment.

I got my current maven configuration from a colleague of mine.

When ever a job runs, it fails after a couple of seconds with following error message:

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

Here are my spring dependencies:

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

I appreciate any help, I couldn't find a solution for my error :/

Thanks a lot!

I think you mean

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

not spring-boot-starter-processor , check it out here: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-configuration-processor/1.5.9.RELEASE

It looks like the root issue you are having is attempting to use a dependency that does not exist ( spring-boot-starter-processor from org.springframework.boot ). Fixing the dependency name to the one that is actualy defined in your parent - spring-boot-starter-parent will also fix your "version" problem.

The error you are seeing is saying a different thing (no version defined) because each maven dependency needs to have a version defined directly or in the dependency management. Since you have set up spring-boot-starter-parent as a parent, it uses dependency versions for all valid dependencies from there.

If for any reason this is a correct dependency name (which would be very strange), you will fix the error by properly defining the version, like:

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

or via dependency management: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management

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