cake uberwar fails due to :library-path project key being a vector
davidsantiago opened this issue · comments
On line 203 of cake/tasks/jar.clj, a call to add-zipfileset is attempting to create a file out of (:library-path *project*)
. Since all project path keys are now vectors of strings, this won't work.
Fixing it won't be trivial either, because the ant
macro in uncle limits the full use of the Clojure language in its body. Ideally what you'd want to do is, within the ant
call, loop over the elements of that key and call add-zipfileset to each one. But because the ant
macro just inlines its & forms
args inside a doto
form, this will ruin any attempts at iteration. I ran into this once before when attempting to do the initial conversion and wrote a hack macro to get around it. @Raynes said that he fixed this in uncle itself, but I'm not quite clear on what the fix was, looking at the code.
It seems to me that the ant
macro will always be problematic, and could easily be replaced with little additional ceremony by the ->
macro. Doing so would make it much easier to do "non-standard" things with the Ant tasks from uncle. For example, instead of
(ant War {:dest-file (warfile) :update true}
(add-zipfileset {:dir (file (:library-path *project*))
:prefix "WEB-INF/lib" :includes "*.jar"})
execute)
you could do
(-> (ant-task War {:dest-file (warfile) :update true})
(add-zipfileset {:dir (file (:library-path *project*))
:prefix "WEB-INF/lib" :includes "*.jar"})
execute)
Of course, to fix the problem I am reporting in this issue, you couldn't use ->
very easily, but at least by having the components (the initialized ant task out of my posited ant-task
initialization function and access to add-zipfileset and execute), you could easily write the obvious looping code in a doseq without any worries. The real work is in the initialization anyways. Of course, you would also have to modify add-*
in uncle to return the object being operated on instead of whatever the Ant tasks are returning (which I assume is void). A small price to pay.