Java – best Ivy practice: splitting code into multiple projects or using a project with multiple configurations?
In our work, we have many projects that need to share some common code Some code is completely generic, while some code is shared only by part of our project Should I split the common code into two separate projects or use two different Ivy configurations for a single project?
Option 1 – two separate items
>Proj 1 – publish common as default > proj 1 – publish common XML as default
Potential problem: ask me to have two separate projects, two separate build files and two separate Ivy files
Option 2 – one project, multiple Ivy configurations for different artifacts
>Artifact 1 – common core versions > artifact 2 – common XML published as core XML
Potential problem: I may have to maintain separate source directories in the same project
In either case, common XML components may depend on common core components
So, SF, what can I do to maintain my public code? What problems have I missed with these two approaches, and what are any other advantages / disadvantages or alternative solutions?
Solution
Well, it really depends on how you like to manage your source code But first, the question I want to ask is whether you really need to split the source The idea of public project is to encapsulate code, classes, interfaces, etc., which can be used as a general toolkit by other projects This does not mean that these projects must use everything in commons They may only use a small part of it This is no problem at all, probably because splitting your commons actually exceeds optimization
Think about it – what happens if your next project uses different subsets of the Commons library? Are you breaking up again?