Kotlin Multi-module Project Dependency is Unresolved in test Lifecycle

Since Spring removed the "MODULE" Layout in Spring Boot 2.0, maven was complaining about a non existent LayoutType ENUM when trying Christophs answer.

Looking at the Docs though helped me resolve the issue: https://docs.spring.io/spring-boot/docs/current/maven-plugin/examples/repackage-classifier.html

Specifically adding this to the spring-boot-maven-plugin:

<executions>
  <execution>
    <id>repackage</id>
    <configuration>
      <classifier>exec</classifier>
    </configuration>
  </execution>
</executions>

The problem is caused by Spring Boot's repackaging of the API jar. It moves the class files of your application from the root of the jar into a BOOT-INF/classes folder in the jar. When compiling the integration tests the kotlin compiler only search the root of the jar for class files and does not look into the BOOT-INF folder. As a result it cannot resolve references to the classes in the API jar.

This answer by Damien describes how to make Spring Boot keeping your application classes in the root of the jar. If I add the configuration mentioned there to your api/pom.xml the integration tests in your project compile as expected:

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <layout>MODULE</layout>
    </configuration>
</plugin>