I have a dynamic web project in SpringToolSuite. It is converted into a Maven project.
I am getting the issue:
Mising artifact org.springframew
What worked for me was I downloaded the jar files from mvnrepository I added them from build path and then I did clean compile install in Maven build and then validate the project and then update the project and the errors are gone.
This issue is because of the required .jar files are not available in .m2 repo .
Right click the project ->Maven ->project Update
.
If you are using settings.xml
provided in working organization , then remove that settings.xml
and repeat the step 1.
when you place the settings.xml
, it always tries to download the required .jar
files from the organization repo.
For spring framework, I was using the following dependency in my pom.xml file
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.3.2RELEASE</version>
<scope>test</scope>
</dependency>
But it was giving me the error
Missing artifact org.springframework.boot:spring-boot-starter-test:jar:4.3.2.RELEASE
But when I changed the version to the latest one, the error was removed.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.2.1.RELEASE</version>
<scope>test</scope>
</dependency>
So try using the latest version.
Maven by default downloads the required dependencies to your local repository so they can be accesses faster next time. Maybe the dependency is either corrupted, or removed from your local disk? Did you check that C:\Users\jublikon.m2\repository\org\springframework\spring\4.2.6\spring-4.2.6.jar actually exists and is a valid spring jar file?
I'm quite sure there is no artifact called "spring"
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId> <!-- *** spring doesn't *** exist -->
<version>4.2.6</version>
</dependency>
Depending on the Spring components you need, you should basically include these dependencies:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
In my Spring project, I include the Spring artifacts via a BOM (Bill of Materials):
<properties>
<spring.version>4.2.6.RELEASE</spring.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</dependency>
<!-- more -->
</dependencies>
What worked for me is that I deleted
/Users/username/.m2/repository/org/springframework/spring/
directory
and then run mvn clean install
command in my project.
That way Maven downloaded the real .jar file that was previously I guees not recognized.