I am receiving below compilation error while building Spring Boot application in a build env. However I don't see any error while running Junit test or building(package) it locally on my machine -
src/main/java/com/abc/tests/AbcTest.java : package org.junit does not exist
Here is my pom.xml -
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath />
</parent>
<dependencies>........
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Here are the Steps i tried with no success -
1. placing explicit dependency on junit 4.12 as well as [4.12] in dependency section.
<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency>
- adding maven-surefire-plugin with and without version 2.18.1 of plugin
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <junitArtifactName> junit:junit:4.12</junitArtifactName> </configuration> </plugin>
Is there any other way to force the build process to use 4.12 junit version within pom.xml instead of picking some old version like 3.8 ?
Thanks