1

Apologies in advance for length of this post...

Is it possible to load external Ant task libs so that they can be called from lancet?

I am trying to write a build script in clojure to build some java/ucm (Oracle COTS product) code, part of which needs to grab some WSDLs, generate code bindings with apache axis and compile it all.

Am using leiningen to manage the java dependencies and have written a small leiningen plugin to do the build - using lancet within this to put together the build targets. So far so good.

Initially I tried called the axis class WSDL2Java which does all of the required stuff to grab WSDLs and bind to them. Code shown below:

(import org.apache.axis.wsdl.WSDL2Java)

(deftarget bind-to-wsdls
    (print "Binding to WSDLs...")
    (WSDL2Java/main (into-array String 
         ;; **WARNING** - the lack of space after the '-o'
         ;; is intentional. Won't work if you add a space
         ;; as it creates an output dir called ' src' - 
         ;; note the space.
         (list (str "-o" src-dir) wsdl-file)))
    (println "Done."))

Only problem is that this calls system.exit which terminates my leiingen task, so none of the following tasks, such as compilation and file copying etc, get called.

So next I tried to call the ant task (contained as part of the apache axis project). I added it as a dependency within my project.clj - which works. I can import the class representing the ant task.

(import org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask)

But I am now short of ideas on how to make the underlying ant task available from within my build. I saw a post that indicates that external ant tasks/libs can't be imported into lancet (link here Anyone using webtest without ant?) but wasn't sure I fully understood this - still new to clojure.

Anyway - any ideas gratefully appreciated. :)

Community
  • 1
  • 1
Kris
  • 279
  • 1
  • 3
  • 10
  • After trying various things (including installing a custom SecurityManager to stop the call to system.exit from working, as per http://stackoverflow.com/questions/309396/java-how-to-test-methods-that-call-system-exit) I discovered there is a leiningen plugin on github that does pretty much what I need:: https://github.com/jaley/lein-axis – Kris Jan 10 '12 at 18:10
  • I would still be interested in figuring if loading external Ant libs is possible within lancet. – Kris Jan 10 '12 at 18:12

0 Answers0