Closed tuhlmann closed 8 years ago
looks like we're not quite there with the change :)
I'll take a look. I must admit, I never thought of trying uberjar when testing
@tuhlmann, can you include your project.clj file? This works for me, but perhaps it is a dependancy version problem. I can try and work with your project.clj to see if I can replicate the problem.
If I create a basic project with the minify-assets hook from v0.2.6 then uberjar picks up and minifies the simple css file. See below
(defproject t "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0"]]
:plugins [[lein-asset-minifier "0.2.6"]]
:minify-assets
{:assets
{"resources/site.min.css" "resources/site.css"}}
:hooks [minify-assets.plugin/hooks])
# Remove lein-asset-minifier to ensure we download latest version from clojars
~/Tmp/t$ rm -rf ~/.m2/repository/lein-asset-minifier
~/Tmp/t$ ls resources/
site.css
~/Tmp/t$ lein uberjar
Retrieving lein-asset-minifier/lein-asset-minifier/0.2.6/lein-asset-minifier-0.2.6.pom from clojars
Retrieving lein-asset-minifier/lein-asset-minifier/0.2.6/lein-asset-minifier-0.2.6.jar from clojars
minifying assets...
minifying: /private/tmp/t/resources/site.min.css
assets: site.css
original size: 146082
compressed size: 121380
gzipped size: 19913
Created /private/tmp/t/target/t-0.1.0-SNAPSHOT.jar
Created /private/tmp/t/target/t-0.1.0-SNAPSHOT-standalone.jar
~/Tmp/t$ ls resources/
site.css site.min.css
~/Tmp/t$ jar tvf target/t-0.1.0-SNAPSHOT-standalone.jar | grep site
146082 Sat Feb 13 19:36:58 GMT 2016 site.css
121380 Mon Feb 15 17:24:08 GMT 2016 site.min.css
Leiningen 2.5.3 on Java 1.8.0_25 Java HotSpot(TM) 64-Bit Server VM
@I tried this with the Reagent template (lein new reagent
) and can't reproduce the problem either. I'm on:
Leiningen 2.6.1 on Java 1.8.0_25 Java HotSpot(TM) 64-Bit Server VM
@tuhlmann are you able to update your leiningen environment?
lein upgrade
I suspect your leiningen is a little out of date. I just downgraded my projects clojure version all the way down to clojure 1.5.0 and it still worked, so it is most likely your lein env
Hm, I did upgrade lein, but still the same problem.
tuhlmann@Vala:~/entw/aktuell/numerix$ lein --version
Leiningen 2.6.1 on Java 1.8.0_72 Java HotSpot(TM) 64-Bit Server VM
I ran across the problem before when I passed a String instead of a Vector into a parameter of the project.clj. That was for another plugin, though.
Here's my project.clj:
(defproject numerix "0.1.0-SNAPSHOT"
:description "Numerix is Torsten's
first Clojure project"
:url "http://numerix.at"
:license {:name "Undecided license"
:url "http://www.I-dont-know.yet/license.txt"}
:source-paths ["src/clj" "src/cljs" "dev"]
:test-paths ["test/clj"]
:dependencies [[org.clojure/clojure "1.8.0"]
[reagent "0.5.1"]
[reagent-forms "0.5.15"]
[reagent-utils "0.1.7"]
[secretary "1.2.3"]
[org.clojure/clojurescript "1.7.228"]
[ring/ring-defaults "0.1.5"]
[metosin/ring-http-response "0.6.5"]
[com.stuartsierra/component "0.3.1"]
[org.clojure/tools.namespace "0.2.10"]
[prone "1.0.2"]
[compojure "1.4.0"]
[environ "1.0.1"]
[hiccup "1.0.5"]
[enlive "1.1.6"]
[com.akolov.enlive-reload "0.2.1"]
[org.clojure/core.cache "0.6.4"]
[org.clojure/core.match "0.2.2"]
[org.clojure/core.async "0.2.374"]
[org.clojure/tools.analyzer.jvm "0.6.9"]
[com.cemerick/pomegranate "0.3.0"]
[buddy/buddy-core "0.9.0"]
[buddy/buddy-sign "0.9.0"]
[buddy/buddy-hashers "0.11.0"]
[buddy/buddy-auth "0.9.0"] ; Authentication
[lib-noir "0.9.9"]
[com.novemberain/validateur "2.5.0"] ; form data validation
[com.taoensso/sente "1.7.0"] ; WebSocket communication
[com.taoensso/timbre "4.2.1"] ; Logging
[com.taoensso/encore "2.33.1"]
[com.cognitect/transit-clj "0.8.285"]
[com.cognitect/transit-cljs "0.8.237"]
[com.novemberain/monger "3.0.2"]
[http-kit "2.1.19"]
[riddley "0.1.12"]
[prismatic/schema "1.0.5"]
[clj-time "0.11.0"]
[com.andrewmcveigh/cljs-time "0.4.0"]
[clojure-watch "0.1.11"]
[clojurewerkz/mailer "1.3.0"]
[dragonmark/util "0.1.3" :exclusions [org.clojure/clojure]]
[com.rpl/specter "0.9.2"]
[funcool/cats "1.2.1"]
[funcool/promesa "0.7.0"]
[funcool/cuerdas "0.7.1"]
[re-com "0.8.0" :exclusions [reagent/reagent com.andrewmcveigh/cljs-time]]]
:plugins [
[lein-cljsbuild "1.1.2"]
[lein-environ "1.0.2"]
;[lein-ring "0.9.1"]
[lein-asset-minifier "0.2.6"]
;;;[lein-sassy "1.0.6-SNAPSHOT"]
[lein-sass "0.3.7-SNAPSHOT"]
;;;[deraen/lein-sass4clj "0.2.0"]
;;;[lein-haml-sass "0.2.7-SNAPSHOT"]
[lein-ancient "0.6.8"]
[codox "0.9.4"]]
:min-lein-version "2.5.3"
:jvm-opts ["-Xmx3g" "-Xverify:none"]
:bootclasspath true
;:eval-in :classloader => doesn't work with the minifyer, sass, etc.
:uberjar-name "numerix.jar"
:main numerix.main
:clean-targets ^{:protect false} [:target-path
:compile-path
"resources/public/js"
"resources/public/css"]
:codox {:language :clojure}
:sass {:src "src/scss"
:matches ["style.scss" "landing.scss"]
:output-directory "resources/public/css"
:output-extension "css"
:source-maps true
:command :sassc
:style :compressed}
;:sass { ;; deraen/lein-sass4clj
; :target-path "resources/public/css"
; :source-paths ["src/scss"]
; :output-style :nested
; :verbosity 2
; }
:minify-assets {
:assets { "resources/public/js/landing.min.js"
["resources/vendor-js/jquery/jquery-2.1.4.min.js"
"resources/vendor-js/tether/tether.js"
"resources/vendor-js/bootstrap/bootstrap.js"
"resources/vendor-js/bootstrap/jqBootstrapValidation.js"
"resources/vendor-js/freelancer/freelancer.js"
"resources/vendor-js/freelancer/cbpAnimatedHeader.js"
"resources/vendor-js/freelancer/classie.js"
"resources/vendor-js/freelancer/contact_me.js"]
"resources/public/js/vendor.min.js"
["resources/vendor-js/jquery/jquery-2.1.4.min.js"
"resources/vendor-js/tether/tether.js"
"resources/vendor-js/bootstrap/bootstrap.js"
"resources/vendor-js/bootstrap/jqBootstrapValidation.js"
"resources/vendor-js/custom/page-setup.js"]}}
:doo {:paths {:karma "karma"}}
:repl-options {:init-ns user}
:cljsbuild {:builds {:app {:source-paths ["src/cljs"]
:figwheel { :on-jsload "numerix.app/render-root" }
:compiler {:main numerix.app
;:preamble ["resources/vendor-js/material-ui/material.js"]
:output-to "resources/public/js/app.js"
:output-dir "resources/public/js/out"
;;:externs ["react/externs/react.js"]
;;:source-map "resources/public/js/out.js.map"
:asset-path "/js/out"
:optimizations :none
:source-map-timestamp true
:parallel-build false
:pretty-print true}}}}
:figwheel {
:http-server-root "public"
:server-port 3449
:css-dirs ["resources/public/css"]
}
:profiles {:dev {:dependencies [[ring-mock "0.1.5"]
[ring/ring-devel "1.4.0"]
[leiningen "2.6.1"]
[figwheel "0.5.0-6"]
[figwheel-sidecar "0.5.0-6"]
[asset-minifier "0.1.7"]
[com.cemerick/piggieback "0.2.1"]
[org.clojure/tools.nrepl "0.2.12"]
[pjstadig/humane-test-output "0.7.1"]
[doo "0.1.6"]]
:plugins [[lein-figwheel "0.5.0-6"]
[lein-doo "0.1.6"]]
:injections [(require 'pjstadig.humane-test-output)
(pjstadig.humane-test-output/activate!)]
:env {:dev? true}
:cljsbuild {:builds {:test {:source-paths ["src/cljs" "test/cljs"]
:compiler {
;:output-to "resources/test/compiled.js"
:output-to "target/test.js"
:main "numerix.runner"
:optimizations :none
:parallel-build false}}}
;:pretty-print true
;:preamble ["react/react.js"]
:test-commands {"unit" ["phantomjs"
"resources/test/unit-test.js"
"resources/test/unit-test.html"]}}}
:uberjar {:source-paths ^:replace ["src/clj"]
:hooks [leiningen.cljsbuild leiningen.sass minify-assets.plugin/hooks]
:env {:production true}
;:aot :all
:aot [numerix.main]
:omit-source true
:cljsbuild {:jar true
:builds {:app
{:source-paths ^:replace ["src/cljs"]
:compiler {
:optimizations :advanced
:pretty-print false}}}}}})
Found the problem! This works:
:minify-assets {
:assets { "resources/public/js/landing.min.js"
"resources/vendor-js/jquery/jquery-2.1.4.min.js"
}}
This fails:
:minify-assets {
:assets { "resources/public/js/landing.min.js"
["resources/vendor-js/jquery/jquery-2.1.4.min.js"]
}}
The difference is the vector of assets to minify...
That's great news. Thanks for the patience.
@publicmayhem No problem, thanks for the quick response!
Just to make sure I understand correctly- passing a vector with multiple source artifacts should be possible, right?
@tuhlmann yep, your right. I will investigate and make the necessary change
@publicmayhem thanks of spearheading all this ;)
ok latest and greatest is up on Clojars, hopefully everything's back to normal ;)
Thanks guys, everything works fine now!
Here's another problem I'm facing with version 0.2.6 of the plugin.
While normal dev mode works fine,
lein uberjar
aborts with this error message:This is my hooks config in uberjar:
Removing the minify-assets hook resolves the crash, so does switching back to plugin version 0.2.4.