Possible to add dependency within leiningen plugin dynamically?
Eg: I have a leiningen plugin I'm building that calls some jdbc stuff, but the specific driver would be specified in the project that brings in my plugin as a dependency. Would this be possible? If so, how would I go about it? Was looking into leinjacker, but having trouble accomplishing what I want. Thanks in advance! -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Possible to add dependency within leiningen plugin dynamically?
On Thursday, 11 July 2013 12:24:34 UTC+5:30, Chris Kuttruff wrote: Eg: I have a leiningen plugin I'm building that calls some jdbc stuff, but the specific driver would be specified in the project that brings in my plugin as a dependency. Can you describe your use case with an example maybe? I am not sure if it's similar to what you want, but some time back I wrote a plugin called lein-servlet that can fetch a user-specified dependency (in project.clj) from Clojars. Checking out the sample project.clj is pretty easy -- run the following at command line: $ lein new lein-servlet foo $ cd foo $ lein servlet run # Ctrl+C to stop $ # see the project.clj that uses Jetty by default The plugin is here: https://github.com/kumarshantanu/lein-servlet Shantanu -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Possible to add dependency within leiningen plugin dynamically?
Shantanu, thanks for the reply; yes, that definitely seems like a similar situation. I will take a close look at that code tomorrow. Here is the example that you requested: Entry point for the plugin: https://github.com/ckuttruff/clj-sql-up/blob/master/src/leiningen/clj_sql_up.clj Function that is called: https://github.com/ckuttruff/clj-sql-up/blob/master/src/clj_sql_up/migrate.clj Example project.clj that uses the plugin: (defproject foo 0.1.0 :plugins [[clj-sql-up 0.1.0]] :clj-sql-up {:database jdbc:postgresql://localhost:5432/slackz?slackz}) Leiningen call: lein clj-sql-up migrate ** Note: I know there are some existing tools to manage db migrations, but I'm developing this in large part to learn more about leiningen / writing plugins. Thanks again, -Chris On Thursday, July 11, 2013 12:19:03 AM UTC-7, Shantanu Kumar wrote: On Thursday, 11 July 2013 12:24:34 UTC+5:30, Chris Kuttruff wrote: Eg: I have a leiningen plugin I'm building that calls some jdbc stuff, but the specific driver would be specified in the project that brings in my plugin as a dependency. Can you describe your use case with an example maybe? I am not sure if it's similar to what you want, but some time back I wrote a plugin called lein-servlet that can fetch a user-specified dependency (in project.clj) from Clojars. Checking out the sample project.clj is pretty easy -- run the following at command line: $ lein new lein-servlet foo $ cd foo $ lein servlet run # Ctrl+C to stop $ # see the project.clj that uses Jetty by default The plugin is here: https://github.com/kumarshantanu/lein-servlet Shantanu -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Possible to add dependency within leiningen plugin dynamically?
Brilliant! worked perfectly for me... found the magic you were referring to in load-deps ( https://github.com/kumarshantanu/lein-servlet/blob/master/plugin/src/leiningen/servlet.clj#L35 ) and the pomegranate/add-dependencies call ( https://github.com/cemerick/pomegranate/blob/master/src/main/clojure/cemerick/pomegranate.clj#L57 ) Thanks so much for sharing... btw, how does that require work for the pomegranate when it isn't listed in your project.clj dependencies. seems like some chicken and egg type problem -Chris On Thursday, July 11, 2013 12:19:03 AM UTC-7, Shantanu Kumar wrote: On Thursday, 11 July 2013 12:24:34 UTC+5:30, Chris Kuttruff wrote: Eg: I have a leiningen plugin I'm building that calls some jdbc stuff, but the specific driver would be specified in the project that brings in my plugin as a dependency. Can you describe your use case with an example maybe? I am not sure if it's similar to what you want, but some time back I wrote a plugin called lein-servlet that can fetch a user-specified dependency (in project.clj) from Clojars. Checking out the sample project.clj is pretty easy -- run the following at command line: $ lein new lein-servlet foo $ cd foo $ lein servlet run # Ctrl+C to stop $ # see the project.clj that uses Jetty by default The plugin is here: https://github.com/kumarshantanu/lein-servlet Shantanu -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Possible to add dependency within leiningen plugin dynamically?
On Friday, 12 July 2013 05:00:43 UTC+5:30, Chris Kuttruff wrote: Brilliant! worked perfectly for me... found the magic you were referring to in load-deps ( https://github.com/kumarshantanu/lein-servlet/blob/master/plugin/src/leiningen/servlet.clj#L35) and the pomegranate/add-dependencies call ( https://github.com/cemerick/pomegranate/blob/master/src/main/clojure/cemerick/pomegranate.clj#L57) Thanks so much for sharing... btw, how does that require work for the pomegranate when it isn't listed in your project.clj dependencies. seems like some chicken and egg type problem Glad it worked for you. Pomegranate is included as one of Leiningen's dependency so it's available to all leiningen plugins by default. More specifically, Leiningen depends on Leiningen-core, which in turn depends on Pomegranate as you can see at the URLs below: https://github.com/technomancy/leiningen/blob/master/project.clj#L9 https://github.com/technomancy/leiningen/blob/master/leiningen-core/project.clj#L11 Shantanu -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.