Fork me on GitHub
#polylith
<
2022-02-01
>
Stefan14:02:04

I was wondering: we have three server applications in our polylith repo. We’re normally building them as separate uberjars and deploying them seperately. Now we have a demo setup where it would be convenient to run all of them in one uberjar. This is quite easy to do with polylith, just add a new project and a new base and I’m done. The thing I don’t like about that though, is the duplication of the component dependencies between the different project definitions. This is a bit brittle, because people are probably going to forget adding new components also to the “all-in-one” project. I tried to add a dependency directly from “all-in-one” to “project-a” let’s say, but Poly doesn’t like that: it expects that components that are required are also specified in deps.edn. Did anybody come up with a nice solution to prevent the duplication of the dependencies?

tengstrand06:02:48

Hi. Ok, so when you add component x to project-a then you also want to make sure it is also added to the all-in-one project? My suggestion is that you write a little program that can calculate if any brick is missing (which can be put in a new component in your workspace). By calling e.g. ws get:projects:project-a:component-names:src and the three other variants that include base-names and the test source, you should be able to collect all used bricks for a project and then you can do that for all the three projects and compare it with the bricks in all-in-one and see if you have any missing bricks. The ws command can be executed from the code via the workspace function that lives in the api component of the polylith repo (make sure you add a dependency on the https://github.com/polyfy/polylith repo, to get access to the code) . Then you can create a githook to make sure it is executed before developers commit their code.

oly10:02:15

This is of interest something we are planning to do kind of support microservice and monolithic architecture to allow us to adapt, currently we use a more monolith style but we can build with smaller projects in mind and switch if the need arises

tengstrand11:02:03

Sounds like a good plan.

Stefan10:02:45

@U1G0HH87L Thanks for your suggestions, I’ll see if I can put something together 🙂

👍 1