Skip to content

Commit

Permalink
Prompt to overwrite if pom.xml exists already.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Nov 17, 2009
1 parent ebd3c2c commit 4b65172
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 5 additions & 1 deletion README.md
Expand Up @@ -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)

Expand All @@ -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?
Expand Down
10 changes: 6 additions & 4 deletions src/leiningen/pom.clj
Expand Up @@ -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)))

0 comments on commit 4b65172

Please sign in to comment.