vessel icon indicating copy to clipboard operation
vessel copied to clipboard

Proposal: multiple output JARs to avoid merges

Open hlship opened this issue 11 months ago • 0 comments

I had an idea about how to avoid merging.

What if vessel created a series of JARs; the first jar, let's call it main.jar contains the compiled AOT sources and most resources. When there's a conflict (a resource already exists in main.jar), a new JAR (let's call it resources_0.jar) is created to contain it.

Basically, layers. When a file conflicts with something in the main layer, we find or create a new layer where it can live.

The final result is the main JARs, and 0 or more resources JARs. We just ensure that all of these are on the classpath in the running application (i.e., load them all into WEB-INF/lib, or something equivalent for non-WAR applications).

When I went down the rabbit hole of merging resources, it's because the thing I wrote (which looks for a particular set of files on the classpath) works fine for REPL development, but couldn't work in production because in a JAR each file can appear only once.

~I'm also looking to see if there's a way to build a JAR file where the same file occurs multiple times.~ Nope, there isn't.

hlship avatar Mar 02 '24 20:03 hlship