polylith icon indicating copy to clipboard operation
polylith copied to clipboard

Build isolated jar files out of projects by changing the top namespace

Open tengstrand opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. Polylith is not well suited for building libraries as it is today. The problem is that if we for example build two libraries (as jar files) out of two project, then the user of these libraries can get into trouble if the same brick is used in both projects.

One example is when we build version 1 of library a and b and then modify a shared component c and build version 2 of both libraries. If we now include a and b in our class path, we will get different versions of c depending on which of the libraries a or b comes first in the classpath.

Describe the solution you'd like To guarantee that version 1 of a library only uses bricks from version 1, we need to change the top namespace of all bricks in the project we build from, e.g. com.mycompany to com.mycompany.mylib (by copying the code and rename all namespaces and references to them in the code) before we build the jar.

This functionality is probably best implemented as a custom command when we have support for that.

tengstrand avatar Apr 12 '22 05:04 tengstrand