Reputation: 2002
I'm following a chapter "Extending Spring Boot Apps" from the book "Pro Spring Boot". In this chapter the writer starts by explaining how to create your own spring-boot-starter-. Source code can be found here. I'm quite new to both maven and spring.
It works fine if I use the same spring-boot version as the writer, 1.3.3.RELEASE. But it does not work with the current version of spring-boot, and I want to make it work with the current version.
The basic folder structure:
**/journal/
|-- spring-boot-journal
| |-- src
| |-- pom.xml
|-- journal-spring-boot-autoconfigure
| |-- src
| |-- pom.xml
|-- journal-spring-boot-starter
| |-- src
| |-- pom.xml
|-- pom.xml
The error I get, after executing '**/journal/mvn clean package -DskipTests=true', when using the spring-boot version 1.4.2.RELEASE instead of 1.3.3.RELEASE is:
**/journal-spring-boot-autoconfigure/src/**/JournalAutoConfiguration.java cannot find symbol: class JournalRepository
Importing classes from the submodule spring-boot-journal does not work anymore. The spring-boot docs does not cover how to import from a submodule in the -spring-boot-autoconfigure module. How would I do/fix this in the current version of spring-boot (1.4.2.RELEASE)?
I noticed a difference between the jar packaging which could explain the error:
1.4.2.RELEASE: BOOT-INF/classes/com/apress/spring/repository/JournalRepository.class
1.3.3.RELEASE: com/apress/spring/repository/JournalRepository.class
Upvotes: 1
Views: 258
Reputation: 33091
The module in which JournalRepository
must remain a module and not a full-blown Spring Boot application. Looking at the source code it's clearly not the case so I am going to reach out to Felipe to see if that can be changed.
In 1.4 (as you've discovered yourself), the packaging has changed to enforce this: rather than putting classes at the usual location for a "simple jar" we now put them in a separate location to make things consistent (you wouldn't use a war as a library dependency either).
The updated documentation of the maven plugin explains how you can use a classifier
so that the main artifact remains a simple library
Upvotes: 3