Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Clojure by
closed by

Main-Class set in manifests of {{target/clojure.jar}} (or jars in Maven repository) gives impression, that they can be run as standalone JAR-packaged applications.

However running them with
`java -jar clojure-${version}.jar`
results in

`

Exception in thread "main" java.lang.ExceptionInInitializerError
at clojure.main.<clinit>(main.java:20)
Caused by: Syntax error compiling at (clojure/main.clj:1:1).
at clojure.lang.Compiler.load(Compiler.java:7647)
...
... 1 more
Caused by: java.io.FileNotFoundException: Could not locate clojure/spec/alpha__init.class, clojure/spec/alpha.clj or clojure/spec/alpha.cljc on classpath.
at clojure.lang.RT.load(RT.java:466)
at clojure.lang.RT.load(RT.java:428)

`

(It of course works perfectly fine for top-level {{clojure.jar}} built in local profile with dependencies shaded.)

Yet, for {{java -jar}} classpath cannot be modified in command line ({{-cp}} is ignored), only as Class-Path entries in manifest.
I'd prefer to see clean

`no main manifest attribute...`
reported by {{java}} rather than {{ExIIError}} and stack trace in such case.

Screened by: Alex Miller - correctly builds normal Clojure without a main class, but continues to build local jar with a main (that one includes the spec deps).

closed with the note: Fixed in 1.10.2-rc1

5 Answers

0 votes
by

Comment made by: alexmiller

Thanks, good call.

0 votes
by

Comment made by: pzygielo

I see it has assigned 1.11 as fix version, but I also saw preparation for 1.10.1. Could CLJ-2459 be included in 1.10.1 as well?

0 votes
by

Comment made by: alexmiller

We are trying to keep the changes in 1.10.1 very focused, so it will wait for 1.11.

0 votes
by

Comment made by: pzygielo

Understood, thanks.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-2459 (reported by pzygielo)
...