title: MAVEN! Spring Boot takes wrong dependency version mentioned in dependency project
body: <p>I have two Spring Boot projects, and want to use one of them as MAVEN dependency in other.</p>
  
  <ul>
  <li>Project Scraper depends on Database project</li>
  <li>Project Database contains database layer (Entities and DAO are build and tested here)</li>
  </ul>
  
  <p>In Database project I have to override the Hibernate version, and did like described in <a href="https://spring.io/blog/2016/04/13/overriding-dependency-versions-with-spring-boot" rel="nofollow noreferrer">https://spring.io/blog/2016/04/13/overriding-dependency-versions-with-spring-boot</a> option 2.</p>
  
  <pre><code>&lt;properties&gt;
  ...
      &lt;hibernate.version&gt;5.2.10.Final&lt;/hibernate.version&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p>This works fine and I see proper version in MAVEN depdndencies for Database project: 
  /home/pm/.m2/repository/org/hibernate/hibernate-core/5.2.10.Final/<strong>hibernate-core-5.2.10.Final.jar</strong></p>
  
  <p>Than I come to Scraper project. It not contain any Hibernate in Maven dependencies, as I not import them explicitly. Now I add my Database prject dependency</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;web.scraper.database&lt;/groupId&gt;
          &lt;artifactId&gt;DataBase&lt;/artifactId&gt;
          &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>And this imports hibernate as well, but with wrong version (version mentioned in Spring parent pom, instead of my Database project Hibernate version)
  /home/pm/.m2/repository/org/hibernate/hibernate-core/5.0.12.Final/<strong>hibernate-core-5.0.12.Final.jar</strong></p>
  
  <p><strong>I want to get hibernate version mentioned in Database project dependecy. Ho to do this?</strong></p>
  
  <p>I would like to not override Hibernate version in Scraper project.</p>
  
  <p>Scraper/pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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;web.scraper.engine&lt;/groupId&gt;
      &lt;artifactId&gt;Scraper&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;Scraper&lt;/name&gt;
      &lt;description&gt;Web scraper application&lt;/description&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.6.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;web.scraper.database&lt;/groupId&gt;
              &lt;artifactId&gt;DataBase&lt;/artifactId&gt;
              &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;6.0.6&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&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;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Database/pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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;web.scraper.database&lt;/groupId&gt;
      &lt;artifactId&gt;DataBase&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;DataBase&lt;/name&gt;
      &lt;description&gt;Data base model and DAO&lt;/description&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.4.RELEASE&lt;/version&gt;
          &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
          &lt;!-- Need to set Hibernate version explicitly,
          because java 8 date and time not mapped properly
          with default version --&gt;
          &lt;hibernate.version&gt;5.2.10.Final&lt;/hibernate.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&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;dependency&gt;
              &lt;groupId&gt;com.h2database&lt;/groupId&gt;
              &lt;artifactId&gt;h2&lt;/artifactId&gt;
              &lt;!-- 
              &lt;scope&gt;runtime&lt;/scope&gt;
               --&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;!-- This makes H2 web console available --&gt;
          &lt;!-- 
              &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;
          --&gt;             
  
  &lt;!-- 
          &lt;dependency&gt;
              &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
              &lt;version&gt;1.1.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
   --&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
              &lt;version&gt;5.4.1.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  
  &lt;/project&gt;
  </code></pre>