Question

Let's say I create a new leiningen project and edit the project.clj file so it looks something like the following.

(defproject foobar "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.5.1"]
                 ...
                 [clj-webmaster-tools "0.1.0"]]
  :plugins [[lein-ring "0.8.6"]
            [lein-webmaster-tools "0.1.0"]
  :webmaster {:sitemap "http://www.foobar.com/sitemap-index.xml" :robots "http://www.foobar.com/robots.txt"})

My question is, how do I access the :webmaster key in the project map for use in a leningen plugin I'm writing?

Was it helpful?

Solution

When you write a plugin, the first parameter passed to your plugin function is the project map. It's a standard Clojure persistent map, so you can access it like any other map, i.e.

(defn my-plugin[project] 
  (println (:webmaster project)))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top