building with Leiningen within Maven

77 views
Skip to first unread message

Elango Cheran

unread,
Dec 28, 2015, 12:06:12 AM12/28/15
to clo...@googlegroups.com, clojure-ma...@googlegroups.com
Hi everyone,
I've recently need to come up with a workaround for building a project that basically entails running a Leiningen build within Maven.  

I think that it will get the job done, but it's also definitely not my proudest moment...  which is why I would like to know if anyone understands the original problem, which has something to do with the classloader and how the Clojure code gets built (by Leiningen vs. by Maven):

http://www.elangocheran.com/blog/2015/12/compiling-a-leiningen-project-from-maven/

And out of curiosity, I wonder if anyone out there has thought about quietly slipping in a Leiningen build step into a Maven build?

Thanks,
Elango

Elango Cheran

unread,
Jan 5, 2016, 1:47:35 AM1/5/16
to clo...@googlegroups.com, clojure-ma...@googlegroups.com
I'm guessing that you might be able to accomplish running Clojurescript tests within a Maven build by combining the following:

1. Take a look at the approach of building Clojurescript by running a build.clj script (ex: https://github.com/clojure/clojurescript/wiki/Quick-Start)
2. Clojurescript tests can be easily kicked off if you create a test runner namespace that calls the other test namespaces (https://github.com/clojure/clojurescript/wiki/Testing)
3. You can execute a Clojure script from within Maven either using maven-exec-plugin or clojure-maven-plugin (ex: https://gist.github.com/stuartgunter/3727047/d628cfdd24f2d879f7c621865bdcb8758cda087b).  In either case, within the <execution>, you can choose the <phase> to attach the goal to.  The maven-exec-plugin approach is just the equivalent of what you would do at the command line when running java -cp clojure.jar:<classpath> clojure.main <script> (http://clojure.org/repl_and_main)   If you choose the maven-exec-plugin style, you may have to use the "exec" goal, and if so, remember to include <classpath/> inside <arguments>.

So if you had a test runner namespace like my.app.run-tests, then you would have the .clj file my/app/run_tests.clj, and you would choose a plugin to run that during the test phase.

On Mon, Dec 28, 2015 at 2:02 AM, Mikera <mike.r.an...@gmail.com> wrote:
Thanks for sharing, this is definitely something I have been interested in.

My use case is a little more specific: I'd like to be able to run a Clojurescript test suite as part of a larger Maven build. Has anyone managed to get something like this to work?

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages