polylith

itaied 2026-02-22T06:42:11.333869Z

hey all i'm trying to understand something about local refs and jar (thin-jar) i want to publish a jar lib i have looked at the poly repo and i see the jar function which uses the lifted basis I wonder what it does exactly - only placing the external libs in the pom.xml of the project or also adds the source paths of each component as well? let's say i want to publish a jar of base base-a which depends on component-a and component-b (locally) - how can i publish it so that the external consumer will have the source code of the components as well?

seancorfield 2026-02-22T15:51:13.407459Z

First off, Polylith is designed for building apps from a monorepo, not libraries. There are all sorts of issues you can run into trying to release libraries from a Polylith monorepo. Polylith can do it because because you'll only use the API (library JAR) in the context of a Polylith monorepo with the poly tool (even if it is made available via a :poly alias -- you'll be keeping versions in sync). Second, to answer your question specifically: when building a JAR for deployment, you can only have Maven dependencies in it, so any :local/root deps have to be unrolled -- "lifted" -- into the main basis, instead of being treated as (3rd party) dependencies. I designed that part (of Polylith's build) and it's taken from experiments at work and is definitely a bit sketchy. What's your specific use case for trying to publish a library here? A Polylith repo can be treated as a library via git deps -- but you still need to be very careful about any consumer that might be trying to pull in different versions of libraries from your repo.

itaied 2026-02-22T18:36:59.394129Z

we are building apps (external from the monorepo) and have to publish cljs lib i have understand your issues you raised, it's really something we have to work through thanks!

seancorfield 2026-02-23T00:26:46.847419Z

Yeah, that's a tricky scenario. If that is your only lib from this Polylith repo, and it's only used internally, you might get away with it. If your other projects could consume it in source form as a git dep, that would probably be the simpler solution. Otherwise, yeah, you're going to need that lifted basis approach to make a JAR with all its source components included (since whatever consumes that JAR can't use local deps into the monorepo).