2

I'm trying to merge two Maven projects into one while both of them have <parent> section. Since one of them is a Spring-Boot project, according to this documentation, I should be able to include the necessary dependencies for Spring-Boot into my project by an import:

<dependencyManagement>
     <dependencies>
        <dependency>
            <!-- Import dependency management from Spring Boot -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>2.0.0.BUILD-SNAPSHOT</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

But when I remove the parent section of the Maven project and add the above tag to my <dependencyManagement>, the code does not compile anymore with the following error message:

Error:(5, 45) java: package org.springframework.boot.test.context does not exist

Can someone please tell me how to switch from <parent> to <dependencyManagement>?

Mehran
  • 15,593
  • 27
  • 122
  • 221
  • Please create the one maven module for the spring boot dependencies then import to original maven (Pom.xml) . But one thing without parent spring boot maven dependencies you can't execute spring boot . – Lova Chittumuri Mar 26 '17 at 04:58
  • 1
    That error would happen if you had an older version of `spring-boot-test` on the classpath. Perhaps something in the parent is overriding the import you've shown above? What does the output from `mvn dependency:tree` look like? – Andy Wilkinson Mar 26 '17 at 07:02
  • @LovaChittumuri That's incorrect. You just need to configure Spring Boot's Maven plugin manually rather than inheriting configuration from the parent – Andy Wilkinson Mar 26 '17 at 07:04

0 Answers0