ThomasKA
ThomasKA

Reputation: 191

Spring Boot 1.5.2 Starter Project

I am creating a simple spring boot project by going to http://start.spring.io and selecting web and actuator as dependencies. My spring boot version is 1.5.2.RELEASE. The project gets downloaded to my local machine. Then I unzip the project and import as a maven project to my workspace. I use spring STS IDE (I don't think it matters. But i just wanted to mention this). I do see errors in my project. Apparently it is a build path problem and it is complaining about spring-context-4.3.7.RELEASE.jar. I do see this jar in my maven repository and in java build path though. Anybody knows what this problem is? If I just create a spring boot application with version 1.3.8, it works without any issues and I don't see any build path problem. Am I doing something wrong or could this be a spring packaging issue?

Upvotes: 1

Views: 1616

Answers (2)

kagmole
kagmole

Reputation: 2165

I sometimes get similar errors when my local Maven repository is corrupted.

To fix it, close Spring Tool Suite, then go to <HOME>/.m2/ and delete the repository/ folder or just the folder you think is the culprit, like repository/org/springframework/spring-context/4.3.7.RELEASE/.

Notice that this will result in the need to download again the deleted artifacts.

After that, in you Spring Tool Suite, right-click on your project > "Maven" > "Update project..." > Make sure the right project is selected > "OK".


EDIT

There is a way in Spring Tool Suite (and eclipse I suppose) to know which artifact is corrupted: in the "Problems" view. To show it:

Windows -> Show View -> Problems

And there should be an error entry about a corrupted artifact, like the following:

Archive for required library: 'C:/Users/{username}/.m2/repository/path/to/file.jar' in project 'my-project' cannot be read or is not a valid ZIP file
The project cannot be built until build path errors are resolved

Upvotes: 1

ThomasKA
ThomasKA

Reputation: 191

Thanks for taking time out to post this reply. I tried this prior to making my initial post. Sorry, I didn’t list down everything I tried only because I had tried everything I could think of – for hours and hours. What worked for me is changing the version to 1.5.1.RELEASE from 1.5.2.RELEASE in my pom file; and then in Spring Tool Suite, right-clicking on the project and doing a "Maven" -> "Update project" So now I have the following in my pom file.

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.1.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

I believe it has to do something with the way that spring boot team package their artifacts. This must be a bug.

Upvotes: 0

Related Questions