jbang icon indicating copy to clipboard operation
jbang copied to clipboard

Could we get a way to keep failed builds?

Open sixcorners opened this issue 1 month ago • 4 comments

Could we get a way to keep the build in the event of a failure?

...
8 errors
[jbang] [1:062] Deleting folder /home/.../classes
[jbang] [1:067] Deleting folder /home/.../generated
[jbang] [1:068] [ERROR] Error during compile
dev.jbang.cli.ExitException: Error during compile
...

Something is wrong with the code an annotation processor is generating and I don't know what.

sixcorners avatar Nov 30 '25 10:11 sixcorners

You can use --build-dir to put it outside jbang cache.

Does that work for it?

maxandersen avatar Nov 30 '25 16:11 maxandersen

hmm - seems like we have a bug in this as I can't seem to keep the classes with the related flags.

maxandersen avatar Nov 30 '25 17:11 maxandersen

That flag doesn't let you keep the compiled classes, you need to pass -Djbang.build.keepclasses=true for that.

(we should probably document that, I only used it for debugging but it seems it's useful for others besides us)

Edit: btw I didn't try this, so I don't remember if you can just run jbang -D..., you might have to do JBANG_JAVA_OPTIONS=-D... jbang ...

quintesse avatar Nov 30 '25 21:11 quintesse

yes - thats what I tried as I usually do it that way - but for some reason was not working.

on this laptop using 0.134 I do get the output using:

JBANG_JAVA_OPTIONS=-Djbang.build.keepclasses=true jbang build --build-dir=mydir --fresh env@jbangdev

and yeah we really should have a no-cleanup option or something like that.

maxandersen avatar Dec 01 '25 07:12 maxandersen