Himanshu Singh
Himanshu Singh

Reputation: 1

Spring Tool Suite Maven project error in pom.xml at xsi:schemaLocation

I just started my first maven project, but got error at the very first line of pom.xml file at the xsi:schemaLocation part.

My pom.xml is

<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>com.example.demo</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Demo Course API</name>

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

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>
<properties>
    <java.version>1.8</java.version>
</properties>


<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.4.2</version>
        </plugin>
    </plugins>
</build>
</project>

The first few lines of error description are

Failure to transfer com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0 from https://repo.maven.apache.org/maven2 was cached in the 
 local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not 
 transfer artifact com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0 from/to central (https://repo.maven.apache.org/maven2): The operation was 
 cancelled. org.eclipse.aether.transfer.

I just copied it from the spring getting started guides but still got the error.don't know what to do. My mvn -v is 3.5.2

Upvotes: 0

Views: 8622

Answers (3)

Mr.R0bot
Mr.R0bot

Reputation: 131

There is incompatibilities between the version of M2E and the version 3.1.2 of the maven-jar-plugin.

Until the problem is solved by the development teams of M2E or maven-jar-plugins, you have to add in your pom.xml file the following line in order to solve this issue:

</project>
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.1</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

Upvotes: 1

Himanshu Singh
Himanshu Singh

Reputation: 1

Analyzing the error description helped a lot in solving the above problem. The error count was 53.

First as stated by @Duho adding the jackson dependency helped in reducing some error, now the error count reduced to 35. Then the error was in the hibernate validator dependency, i fixed this by adding the hibernate validator dependency. Dependencies can be added by right clicking the project-->Maven-->Add Dependency .

Then i found out that maven downloaded some incompleted files from central repository to local repository, the download was incomplete. So, i deleted all files with ".lastUpdated" extension from Users/'myName'/.m2/repository folder.

Then by updating the project from right click-->Maven-->Update Project helped in solving all the errors.

It worked for me.. hope this works for anyone with the same problem.

Upvotes: 0

Duho
Duho

Reputation: 21

Try including this dependency in your pom.xml and check:

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.9.0.pr2</version>
</dependency>

Upvotes: 0

Related Questions