This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-09-14
Channels
- # admin-announcements (5)
- # alda (2)
- # beginners (26)
- # boot (30)
- # cider (8)
- # clojure (49)
- # clojure-argentina (1)
- # clojure-berlin (1)
- # clojure-boston (1)
- # clojure-italy (11)
- # clojure-norway (3)
- # clojure-russia (116)
- # clojurescript (156)
- # clojurex (4)
- # clojutre (9)
- # core-async (6)
- # datomic (18)
- # emacs (1)
- # events (4)
- # hoplon (159)
- # ldnclj (13)
- # luminus (4)
- # off-topic (1)
- # re-frame (14)
- # reagent (76)
Hi,
I’m having trouble getting -main to work in a jar.
I’m making a little survival command line game, so the -main is in survival/cli.clj
like so …
(ns survival.cli
(:require [survival.play :as play]))
(defn -main [& args]
(println "Hi”))
my build.boot is …
(set-env!
:source-paths #{"src" "test"}
:dependencies '[[midje "1.7.0" :scope "test”]
[zilti/boot-midje "0.1.2" :scope "test"]])
(require '[zilti.boot-midje :refer [midje]])
(task-options!
aot {:all true}
pom {:project ‘survival
:version "0.1.0"}
jar {:main 'survival.cli})
(deftask build []
(comp (aot) (pom) (uber) (jar)))
running boot build
makes the jar with the cli compiled in it
$ jar -tf target/survival-0.1.0.jar | grep cli
survival/cli$_main.class
survival/cli__init.class
survival/cli$loading__5340__auto____244.class
survival/cli$fn__310.class
but the jar doesn’t work …
$ java -jar target/survival-0.1.0.jar
Error: Could not find or load main class survival.cli
I’m stumped 😕
what did I miss?
(using boot version 2.2.0 and clojure 1.7.0)@boz: Looks like aot {:all true}
is not working. You can either try to find out reason for that or move clj sources to resource-paths so that they are available in the jar
@juhoteperi: Hey, I’m trying to get boot-less to work with less4j-javascript, but I keep getting java.lang.IllegalArgumentException: No matching field found: getSourceMapConfiguration for class com.github.sommeri.less4j.LessCompiler$Configuration
Is this something I can fix on my side?
@joelkuiper: What is less4j-javascript?
an extension to less that allows you to evaluate inline javascript
I have a bunch of mixins from another project that look like
.boxShadow(@value1,@value2:X,...) {
@value: ~`"@{arguments}".replace(/[\[\]]|\,\sX/g, '')`;
-moz-box-shadow: @value;
-webkit-box-shadow: @value;
box-shadow: @value;
}
which throws an error with just vanilla less4j (not the “standard” command line tools though)
eg ERROR file:...mixins.less 95:13 Escaped script ~`...`are not supported. The problem can be solved using custom functions. Compilation resulted in incorrect CSS.
@joelkuiper: What are you doing currently? Looks like Less4Javascript requires custom configuration object
currently I’m forking less4clj and trying if I can jerryrig the library in 😛
Yeah, that should work
you’re aware that your tests fail?
@juhoteperi: pull request!
the less4j-javascript concept is mindbending
not sure yet, still bending
@juhoteperi: shall and try and update boot-less as well?
I’m not completely convinced either of its merits. But I need to share style sheets with another project where the devs love it … so enabling support is easier than refactoring 😛
and apparently it’s build in functionality of the nodejs less compiler
@juhoteperi: Thanks for the reply
It wasn’t the AOT, it was a missing
(:gen-class)
and then I discovered I’d forgot the clojure dependency in build.boot
Works with cli.clj
...
(ns survival.cli
(:require [survival.play :as play])
(:gen-class))
(defn -main [& args]
(println "Hi”))
and build.boot
…
(set-env!
:source-paths #{"src" "test"}
:dependencies '[[org.clojure/clojure "1.7.0"]
[midje "1.7.0" :scope "test"]
[zilti/boot-midje "0.1.2" :scope "test"]])
(require '[zilti.boot-midje :refer [midje]])
(task-options!
aot {:all true}
pom {:project 'survival
:version "0.1.0"}
jar {:main 'survival.cli})
(deftask build
"Builds a runnable jar for the CLI Survival game."
[]
(comp (aot) (pom) (uber) (jar)))
Anybody see this exception when including deps.cljs? clojure.lang.ExceptionInfo: No ns form found in file:/home/dave/.boot/cache/tmp/home/dave/allgress/survey-response/jl6/-c4hx1l/deps.cljs at line 1 /home/dave/.boot/cache/tmp/home/dave/allgress/survey-response/jl6/aebh7k/boot/cljs/main2339.cljs
Never mind - adding the .cljs.edn file fixed it.