title: package org.springframework.boot.test.context does not exist
body: <p>I am using dependencies as below</p>
  
  <pre><code>&lt;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"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.app&lt;/groupId&gt;
      &lt;artifactId&gt;App&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;0.0.2-SNAPSHOT&lt;/version&gt;
      &lt;properties&gt;
          &lt;main.basedir&gt;${basedir}/../..&lt;/main.basedir&gt;
          &lt;ant.version&gt;1.9.3&lt;/ant.version&gt;
      &lt;/properties&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;1.5.7.RELEASE&lt;/version&gt;
      &lt;/parent&gt;
      &lt;build&gt;
          &lt;finalName&gt;CransoApp&lt;/finalName&gt;
          &lt;sourceDirectory&gt;src&lt;/sourceDirectory&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;!--&lt;plugin&gt;
                  &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;warSourceDirectory&gt;WebContent&lt;/warSourceDirectory&gt;
                      &lt;failOnMissingWebXml&gt;true&lt;/failOnMissingWebXml&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;--&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;dependencies&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                          &lt;artifactId&gt;springloaded&lt;/artifactId&gt;
                          &lt;version&gt;1.2.6.RELEASE&lt;/version&gt;
                      &lt;/dependency&gt;
                  &lt;/dependencies&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.6&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;copy-resources&lt;/id&gt;
                          &lt;phase&gt;validate&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;copy-resources&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;outputDirectory&gt;${basedir}/target/classes/public&lt;/outputDirectory&gt;
                              &lt;resources&gt;
                                  &lt;resource&gt;
                                      &lt;directory&gt;src/main/webapp&lt;/directory&gt;
                                      &lt;filtering&gt;true&lt;/filtering&gt;
                                  &lt;/resource&gt;
                                  &lt;!--&lt;addResources&gt;true&lt;/addResources&gt;--&gt;
                              &lt;/resources&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;descriptorRefs&gt;
                          &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
                      &lt;/descriptorRefs&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;!-- end::web[] --&gt;
          &lt;!-- tag:: Spring Data JPA --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;!-- end:: Spring Data JPA --&gt;
          &lt;!-- tag::security[] --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
              &lt;artifactId&gt;tomcat-embed-jasper&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
              &lt;optional&gt;true&lt;/optional&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-logging&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.mail&lt;/groupId&gt;
              &lt;artifactId&gt;mail&lt;/artifactId&gt;
              &lt;version&gt;1.4.3&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.integration&lt;/groupId&gt;
              &lt;artifactId&gt;spring-integration-mail&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.velocity&lt;/groupId&gt;
              &lt;artifactId&gt;velocity&lt;/artifactId&gt;
              &lt;version&gt;1.6.4&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/junit/junit --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/org.jboss.arquillian.junit/arquillian-junit-container
  --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jboss.arquillian.junit&lt;/groupId&gt;
              &lt;artifactId&gt;arquillian-junit-container&lt;/artifactId&gt;
              &lt;version&gt;1.1.13.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.h2database&lt;/groupId&gt;
              &lt;artifactId&gt;h2&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt; &lt;/project&gt;
  </code></pre>
  
  <p>When I try to run "mvn test" it ends in below error. My IDE can find the SpringBootTest and SpringRunner classes.</p>
  
  <pre><code>    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project App: Compilation failure: Compilation failure:
      [ERROR] /E:/WebProjects/app/src/test/java/com/app/SpringBootAppTest.java:[5,45] package org.springframework.boot.test.context does not exist
      [ERROR] /E:/WebProjects/App/src/test/java/com/app/SpringBootAppTest.java:[6,47] package org.springframework.test.context.junit4 does not exist
      [ERROR] /E:/WebProjects/App/src/test/java/com/app/SpringBootAppTest.java:[11,2] cannot find symbol
      [ERROR]   symbol: class SpringBootTest
      [ERROR] /E:/WebProjects/App/src/test/java/com/app/SpringBootAppTest.java:[12,10] cannot find symbol
      [ERROR]   symbol: class SpringRunner
  </code></pre>
  
  <p>How to overcome the test setup issue on the below code?
  And I have tried cleaning .m2 directory and re-downloaded the dependencies.</p>
  
  <blockquote>
  <pre><code>package com.app;
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.springframework.boot.test.context.SpringBootTest;
  import org.springframework.test.context.junit4.SpringRunner;
  @RunWith(SpringRunner.class)
  public class SpringBootAppTest {
  @Test
  public void runBootTest(){
      assert("test").equalsIgnoreCase("Test");
  }
  }
  </code></pre>
  </blockquote>
  
  <p><code>.m2</code> directory has the required jars. My IDE able to find the classes. Either way I can't run the maven test with cli and IDE. If any version that I use has conflict over another? I can easily build new project with <code>parent 1.5.7</code> and <code>spring-boot-starter-test</code> dependencies. But why can't the same doesn't work in this setup? Even debug mode doesn't give much detail about the missing classes.</p>