Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

cake uberwar fails due to :library-path project key being a vector #119

davidsantiago opened this Issue Jun 24, 2011 · 0 comments


None yet
2 participants

davidsantiago commented Jun 24, 2011

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"})

you could do

(-> (ant-task War {:dest-file (warfile) :update true})
      (add-zipfileset {:dir (file (:library-path *project*))
                            :prefix "WEB-INF/lib" :includes "*.jar"})

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.

@Raynes Raynes closed this in 50e3827 Jun 24, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment