From 4b65172b39baf6da571765f53a18193b6daafc55 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Mon, 16 Nov 2009 20:24:36 -0800 Subject: [PATCH] Prompt to overwrite if pom.xml exists already. --- README.md | 6 +++++- src/leiningen/pom.clj | 10 ++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0b5800ae6..4e47fdba8 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Copy bin/lein to a location on your $PATH and run: $ lein self-install $ lein uberjar # create a standalone jar that contains all dependencies - $ lein pom # output a pom.xml file describing the project + $ lein pom # output a pom.xml file for interop with Maven $ lein install # install in local repo (currently requires mvn) @@ -64,6 +64,10 @@ Place a project.clj file in the project root that looks something like this: Other keys you can set are :namespaces to compile if you don't want all of them AOT'd as well as a :main namespace for building executable jars. +Currently Leiningen can only be used to compile projects that use the +same version of Clojure as it uses, though this restriction should go +away soon. + ## FAQ **Q:** How do you pronounce Leiningen? diff --git a/src/leiningen/pom.clj b/src/leiningen/pom.clj index 3f42acf69..ff2e5f924 100644 --- a/src/leiningen/pom.clj +++ b/src/leiningen/pom.clj @@ -39,9 +39,11 @@ (.setMavenProject (MavenProject. (make-model project))))) (defn pom [project & [args]] - ;; TODO: prompt if pom.xml exists (let [pom-file (file (:root project) "pom.xml")] - (.writeModel (MavenProject. (make-model project)) - (writer pom-file)) - (println "Wrote pom.xml") + (when (or (not (.exists pom-file)) + (do (print "pom.xml exists; overwrite? ") (flush) + (re-find #"^y(es)?" (.toLowerCase (read-line))))) + (.writeModel (MavenProject. (make-model project)) + (writer pom-file)) + (println "Wrote pom.xml")) (.getAbsolutePath pom-file)))