edge icon indicating copy to clipboard operation
edge copied to clipboard

onejar build doesn't include compiled assets

Open snichme opened this issue 5 years ago • 4 comments

I'm trying out edge and I want to use it with clojurescript. The development part is all working without any issues but when I try to build a production jar, the jar doesn't include the js nor css files. Or at least the requests fails.

I produce the jar by running

../bin/onejar -A:prod --args '-m edge.main' project.jar

and when run the jar I get a 500 for the css file and a 404 for the js file.

Stacktraces: For the js file:

clojure.lang.ExceptionInfo:  {:status 404}
	at yada.methods$eval21592$fn__21593.invoke(methods.clj:146)
	at yada.methods$eval21561$fn__21562$G__21552__21569.invoke(methods.clj:132)
	at yada.methods$eval21605$fn__21612$fn__21621.invoke(methods.clj:188)
	at manifold.deferred$eval3327$chain___3348.invoke(deferred.clj:862)
	at clojure.lang.AFn.applyToHelper(AFn.java:165)
	at clojure.lang.RestFn.applyTo(RestFn.java:132)
	at clojure.core$apply.invokeStatic(core.clj:669)
	at clojure.core$apply.invoke(core.clj:660)
	at manifold.deferred$eval3327$chain___3348$fn__3352.invoke(deferred.clj:888)
	at manifold.deferred.Listener.onSuccess(deferred.clj:219)
	at manifold.deferred.Deferred$fn__3126.invoke(deferred.clj:381)
	at clojure.lang.AFn.run(AFn.java:22)
	at io.aleph.dirigiste.Executor$Worker$1.run(Executor.java:62)
	at manifold.executor$thread_factory$reify__2505$f__2506.invoke(executor.clj:44)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.base/java.lang.Thread.run(Thread.java:835)

For the css file:

java.lang.IllegalArgumentException: No matching clause: onejar
	at yada.resources.resources_resource$new_resources_resource$file_of_resource__28769.invoke(resources_resource.clj:13)
	at yada.resources.resources_resource$new_resources_resource$fn__28772.invoke(resources_resource.clj:23)
	at yada.interceptors$get_properties.invokeStatic(interceptors.clj:112)
	at yada.interceptors$get_properties.invoke(interceptors.clj:109)
	at manifold.deferred$eval3327$chain___3348.invoke(deferred.clj:862)
	at manifold.deferred$eval3327$chain___3348.doInvoke(deferred.clj:883)
	at clojure.lang.RestFn.applyTo(RestFn.java:151)
	at clojure.core$apply.invokeStatic(core.clj:669)
	at clojure.core$apply.invoke(core.clj:660)
	at manifold.deferred$eval3327$chain___3348$fn__3352.invoke(deferred.clj:888)
	at manifold.deferred.Listener.onSuccess(deferred.clj:219)
	at manifold.deferred.Deferred$fn__3126.invoke(deferred.clj:381)
	at clojure.lang.AFn.run(AFn.java:22)
	at io.aleph.dirigiste.Executor$Worker$1.run(Executor.java:62)
	at manifold.executor$thread_factory$reify__2505$f__2506.invoke(executor.clj:44)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.base/java.lang.Thread.run(Thread.java:835)
yada by JUXT

I get the same result by generating a new app with --cljs and build a production artifact directly without any changes, I'm on commit 1d760f41dc7bfe318567b9d1ebb4e45a0a153d98

What am I missing?

snichme avatar Aug 12 '19 19:08 snichme

Make sure you've ran clojure -A:build:build/once so that kick compiles everything.

Also I always use capsule over onejar (although not entirely sure of the difference). We usually end up with a jar-building script that looks something like this:

#!/bin/sh

clojure -A:build:build/once
../bin/capsule -m edge.main -e 'target/prod' -A:prod project.jar

@SevereOverfl0w can probably chime in with some more helpful feedback but hopefully that will get you going

armincerf avatar Aug 12 '19 20:08 armincerf

Hi,

Thank you very much, using your script compiles everything and the jar includes the assets. Not sure why capsule works but not the onejar one.

Will continue by using your script.

snichme avatar Aug 12 '19 20:08 snichme

PR for the docs here: https://github.com/juxt/edge/pull/106

snichme avatar Aug 12 '19 20:08 snichme

Reopening because I think there's an underlying issue here, probably with a double // which java handles differently to onejar's loader.

SevereOverfl0w avatar Aug 13 '19 08:08 SevereOverfl0w