Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Write to pom-generated.xml instead of pom.xml; don't prompt to overwr…

…ite.
  • Loading branch information...
commit 1f53bb8d0046855f0afd41c6c2ad59fff0cc9662 1 parent bda58ab
@technomancy technomancy authored
View
1  .gitignore
@@ -3,5 +3,6 @@ sample/classes/
sample/nomnomnom.jar
classes/
leiningen.jar
+pom-generated.xml
pom.xml
Manifest.txt
View
4 src/leiningen/install.clj
@@ -9,10 +9,10 @@
"Install the project and its dependencies into ~/.m2/repository using Maven."
[project & args]
(let [jarfile (jar project)]
- (pom project)
+ (pom project "pom-generated.xml" true)
;; TODO: use maven-ant-tasks InstallTask with in-memory Pom object
(with-sh-dir (:root project)
- (try (sh "mvn" "install:install-file" "-DpomFile=pom.xml"
+ (try (sh "mvn" "install:install-file" "-DpomFile=pom-generated.xml"
(str "-Dfile=" jarfile))
(println "Installed" (:group project) "/" (:name project))
(catch java.io.IOException _
View
10 src/leiningen/jar.clj
@@ -2,7 +2,8 @@
"Create a jar containing the compiled code and original source."
(:require [leiningen.compile :as compile]
[lancet])
- (:use [clojure.contrib.duck-streams :only [spit]]))
+ (:use [leiningen.pom :only [pom]]
+ [clojure.contrib.duck-streams :only [spit]]))
(defn make-manifest [project]
(doto (str (:root project) "/Manifest.txt")
@@ -15,11 +16,14 @@
the source .clj files. If project.clj contains a :main symbol, it will be used
as the main-class for an executable jar."
[project & args]
- ;; TODO: clean?
(compile/compile project)
+ (pom "pom-generated.xml" true)
(let [jar-file (str (:root project) "/" (:name project) ".jar")
filesets [{:dir *compile-path*}
- {:dir (str (:root project) "/src")} ; TODO: pom too
+ {:dir (str (:root project) "/src")}
+ ;; TODO: place in META-INF/maven/$groupId/$artifactId/pom.xml
+ ;; TODO: pom.properties
+ {:file (str (:root project) "/pom-generated.xml")}
{:file (str (:root project) "/project.clj")}]]
;; TODO: support slim, etc
(apply lancet/jar {:jarfile jar-file
View
2  src/leiningen/new.clj
@@ -19,7 +19,7 @@
(spit (file project-name "src" (str project-name ".clj"))
(str "(ns " project-name ".core)\n"))
(spit (file project-name ".gitignore")
- (str-join "\n" ["pom.xml"
+ (str-join "\n" ["pom-generated.xml"
"Manifest.txt"
(str project-name ".jar")]))
(spit (file project-name "lib" ".gitignore") "*")
View
16 src/leiningen/pom.clj
@@ -48,16 +48,10 @@
(.setProject lancet/ant-project)
(.setMavenProject (MavenProject. (make-model project)))))
-;; TODO: generated poms should use a different filename so we don't
-;; have to worry about overwriting existing ones?
-
-(defn pom [project & [args]]
- (let [pom-file (file (:root project) "pom.xml")]
+(defn pom [project & [pom-location silently?]]
+ (let [pom-file (file (:root project) (or pom-location "pom.xml"))]
(with-open [w (writer pom-file)]
- (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)) w)
- (.write w disclaimer)
- (println "Wrote pom.xml")))
+ (.writeModel (MavenProject. (make-model project)) w)
+ (.write w disclaimer)
+ (when-not silently? (println "Wrote" (.getName pom-file))))
(.getAbsolutePath pom-file)))
Please sign in to comment.
Something went wrong with that request. Please try again.