0

I am new to spring boot. I am trying to migrate project from old spring boot to the latest version.

I changed the version of spring boot in project. But when i build the project it fails in tests throwing computational failure with error below

package org.springframework.test.annotation does not exist

I have this dependency in my project

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-test</artifactId>
        <scope>test</scope>
    </dependency>

Not sure what i could be missing?

Neha
  • 745
  • 4
  • 10
  • 18
  • please mention the old version and the new version – Arunakiran Nulu Jun 21 '18 at 18:17
  • I would guess that Maven corrupted the `spring-test` jar (a dependency on `spring-boot-test`) when it downloaded it. Try clearing out your Maven cache and building your application again. – Andy Wilkinson Jun 21 '18 at 18:33
  • after I added spring-boot-starter-test instead of spring-boot-test it worked. what is the difference between the both and when to use which? – Neha Jun 21 '18 at 18:37

1 Answers1

0

Change spring-boot-test TO spring-boot-starter-test like below :

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-test</artifactId>
        <scope>test</scope>
</dependency>

to

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
</dependency>

Refer http://www.baeldung.com/spring-boot-starters for more info about starters.

Alien
  • 15,141
  • 6
  • 37
  • 57