I wrote a spring boot project using gradle and it works fine. I would like to split up the project into libraries (jars) so that I can reuse them.
@SpringBootTest
and these should be runnable independently.I have uploaded a minimal, reproducible example (reprex) here: https://github.com/david-sackstein/multiproject
It contains three folders:
productcommon
is a jar with a public class ProductFactory
.@RestController
that invokes a public method of ProductFactory in one of its methods. productservice has a project dependcy on productcommon.multiproject
is a gradle project with no code that depends on productcommon
and productservice
When I build productservice
it fails - evidently because the project import of productcommon
fails.
What is missing or incorrect in this example?
Today I came across this excellent post on the subject: https://reflectoring.io/spring-boot-gradle-multi-module by Tom Hombergs
Tom also provides a great example at: https://github.com/thombergs/buckpal
I may have some follow on questions on the subject after working with his architecture but for the moment, I am happy with this solution.