0
votes

My Spring Boot application cannot build. It seems maven is having issues even with the least dependency. I have not added any dependency apart from the spring web, which I have added right from the start.spring.io initializer.

4.0.0 org.springframework.boot spring-boot-starter-parent 2.3.1.RELEASE com.example demo 0.0.1-SNAPSHOT demo Demo project for Spring Boot

<properties>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <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>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

I couldn't upload an image of the error message, but here is the message

Errors occurred during the build. Errors running builder 'Maven Project Builder' on project 'vehicleTransFleets'. Could not calculate build plan: Plugin org.apache.maven.plugins:maven-jar-plugin:3.2.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:3.2.0 Plugin org.apache.maven.plugins:maven-jar-plugin:3.2.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:3.2.0 Could not calculate build plan: Plugin org.apache.maven.plugins:maven-jar-plugin:3.2.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:3.2.0 Plugin org.apache.maven.plugins:maven-jar-plugin:3.2.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:3.2.0

2
Please add an image of the error if it depends on your IDE, and indicate the exact errorA L
"Having issues" is not something we can help you with. A specific error and the context in which you get it is something we might be able to.chrylis -cautiouslyoptimistic-
Please check the post one more time, I have included the error message. Thanks a lotCourage Oghogho

2 Answers

1
votes

Try removing the .m2 folder. It's the maven local repository. It contains all the jar files downloaded from maven and sometimes these files are corrupted. All the required files will be downloaded again when you build the project.

It is in this path by default:

Windows: C:\Users\<User_Name>\.m2

Linux: /home/<User_Name>/.m2

Mac: /Users/<user_name>/.m2

0
votes

Possible issues:

  1. No or unstable network connection, so Maven cannot reach the central repo.
  2. You enabled offline mode in IDEA (or any other IDE you use).
  3. Your organization uses internal repositories and blocks access to the public ones - you may try building through proxy, but permanent solution would be to specify the correct (internal) mirror repositories.
  4. Issues with your local Maven cache - you may try removing folder ~/.m2/repository/org/apache/maven/plugins/maven-jar-plugin/3.2.0 to debug this one.