title: Spring Test succeed on eclipse but fail on gradle build
body: <p>I don't know why but my spring boot test succeed in eclipse when running it as junit, but then fail when I execute the command:</p>
  
  <pre><code>gradle clean build
  </code></pre>
  
  <p>Here is my build.gradle:</p>
  
  <pre><code>buildscript {
      ext {
          springBootVersion = '1.5.8.RELEASE'
      }
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
      }
  }
  
  apply plugin: 'java'
  apply plugin: 'eclipse'
  apply plugin: 'idea'
  apply plugin: 'org.springframework.boot'
  
  sourceCompatibility = 1.8
  targetCompatibility = 1.8
  
  jar {
      baseName = rootProject.name
      version =  project.version
  }
  
  repositories {
      mavenCentral()
  }
  
  
  
  dependencies {
      compile('org.springframework.boot:spring-boot-starter-web')
      compile('org.springframework.boot:spring-boot-starter-data-jpa')
      compile('org.springframework:spring-jdbc')
      compile('mysql:mysql-connector-java')
      compile('javax.validation:validation-api')
      compile('org.hibernate:hibernate-core:5.2.2.Final')
      compile('org.hibernate:hibernate-tools:5.2.0.Final')
      testCompile('com.h2database:h2:1.4.196')
      testCompile('org.springframework.boot:spring-boot-starter-test')
      testCompile('org.springframework.security:spring-security-test')
  
  }
  </code></pre>
  
  <p>All my test fails once I run the gradle command, for various reasons, mainly not being able to create beans and autowire them to the test classes.</p>
  
  <p>Here is a test example:</p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @SpringBootTest(classes = Application.class)
  @DataJpaTest
  @ActiveProfiles("test")
  public class IEmployeeRepositoryTest {
  
  @Autowired
  private TestEntityManager entityManager;
  
  @Autowired
  private IEmployeeRepository employeRepository;
  </code></pre>
  
  <p>And this is the reason why the build/test fails:</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' 
  defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is 
  java.lang.NoSuchMethodError: org.hibernate.engine.spi.SessionFactoryImplementor.getProperties()Ljava/util/Properties;
  </code></pre>
  
  <p>I appreciate all the help I can get, I've been stuck on this for hours.</p>
  
  <p><strong>UPDATE</strong>
  This is the output of  my gradle dependencies:
  <a href="https://i.stack.imgur.com/twaq5.png" rel="nofollow noreferrer">Image to gradle dependencies</a></p>
  
  <p>I should also mention that project structure is this:</p>
  
  <pre><code>src
  ---main
  -----java
  -----resources
  ------application.yml
  ------schema.sql
  ---test
  -----java
  -----resources
  ------application-test.yml
  ------schema-test.sql
  </code></pre>