My current proposal for the Clojure DSL for polyglot maven looks like this:

------------------------------------------------------------------

(defproject com.linkuistics.lamdras/website "1.0-SNAPSHOT"

    :model-version "4.0.0"
    :name "Lamdras Website"
    :description "Acumen / LRMDS Integration"
    :packaging "war"
    :properties {:project.build.sourceEncoding "UTF-8"}
    :dependencies [[ring/ring-servlet "0.2.0-RC2"]
                   [ring/ring-devel "0.2.0-RC2"]
                   [clj-routing/clj-routing "0.1.0-SNAPSHOT"]
                   [clout/clout "0.2.0-SNAPSHOT"]
                   [compojure "0.4.0-SNAPSHOT"]
                   [hiccup "0.1.0-SNAPSHOT"]
                   [org.clojure/clojure "1.2.0-master-SNAPSHOT"]
                   [org.clojure/clojure-contrib "1.2.0-master-SNAPSHOT"]
                   [congomongo "0.1.2-SNAPSHOT"]]
    :provided-dependencies [[org.mortbay.jetty/servlet-api-2.5 "6.1.14"]]
    :final-name "website"
    :plugins [[org.apache.maven.plugins/maven-war-plugin "2.1-beta-1"]
              [org.apache.maven.plugins/maven-compiler-plugin "2.1" :source 
"1.6" :target "1.6"]
              [com.theoryinpractise/clojure-maven-plugin "1.3.1" 
:sourceDirectories ["src/main/java"]
                [:compile-clojure [compile ["compile"]]]]
              [org.mortbay.jetty/maven-jetty-plugin "6.1.10" 
:scanIntervalSeconds 10 :stopKey "foo" :stopPort 9999]])

------------------------------------------------------------------

With logical extension to other maven properties. Note that the configuration 
items for plugins and their executions are inlined, and the executions for 
plugins appear as the vector item in the plugin declaration.

When the group id is the same as the artifact id you can omit the group id.

Configuration items such as :sourceDirectories that have a vector value are 
equivalent to this xml:

  
<sourceDirectories><sourceDirectory>src/main/java</sourceDirectory></sourceDirectories>

An example showing qualifiers and exclusions for dependencies (taken from the 
pom.xml for the top level of polyglot maven itself) is:

------------------------------------------------------------------

(defproject org.sonatype.pmaven/pmaven "0.8-SNAPSHOT"

    :model-version "4.0.0"
    :parent [org.sonatype.forge/forge-parent "5"]
    :name "Polyglot Maven"
    :packaging "pom"
    :url "http://polyglot.sonatype.org/";
    :properties {:forgeSiteId "forge-sites"
                 :mavenVersion "3.0-alpha-7"
                 :project.build.sourceEncoding "UTF-8"
                 :forgeSiteUrl 
"dav:http://repository.sonatype.org/content/sites/forge-sites/${project.artifactId}/${project.version}"}
    :scm {:connection "scm:git:git://github.com/sonatype/polyglot-maven.git"
          :developer-connection 
"scm:git:ssh://g...@github.com/sonatype/polyglot-maven.git"
          :tag "HEAD"
          :url "http://github.com/sonatype/polyglot-maven"}
    :ci-management {:system "Hudson"
                    :url "https://grid.sonatype.org/ci/job/Polyglot-Maven"}
    :issue-management {:system "JIRA"
                       :url "https://issues.sonatype.org/browse/PMAVEN"}
    :dependency-management {:dependencies [[org.apache.maven/apache-maven 
"${mavenVersion}" :classifier "bin" :type "zip"]
                                           
[org.apache.maven/maven-model-builder "${mavenVersion}"]
                                           [org.apache.maven/maven-embedder 
"${mavenVersion}"]
                                           [org.apache.maven/maven-plugin-api 
"${mavenVersion}"]
                                           [org.codehaus.groovy/groovy "1.7.0" 
:exclusions [jline junit org.apache.ant/ant org.apache.ant/ant-launcher]]
                                           [com.google.inject/guice "2.0"]
                                           
[org.sonatype.maven.shell/mvnsh-maven "0.10"]
                                           [org.sonatype.gshell/gshell-core 
"2.5" :classifier "tests"]
                                           [org.sonatype.pmaven/pmaven-common 
"0.8-SNAPSHOT"]
                                           [org.sonatype.pmaven/pmaven-cli 
"0.8-SNAPSHOT"]
                                           
[org.sonatype.pmaven/pmaven-maven-plugin "0.8-SNAPSHOT"]
                                           [org.sonatype.pmaven/pmaven-groovy 
"0.8-SNAPSHOT"]
                                           [org.sonatype.pmaven/pmaven-yaml 
"0.8-SNAPSHOT"]
                                           [org.sonatype.pmaven/pmaven-jruby 
"0.8-SNAPSHOT"]
                                           [org.sonatype.pmaven/pmaven-commands 
"0.8-SNAPSHOT"]
                                           [org.sonatype.pmaven/pmaven-clojure 
"0.8-SNAPSHOT"]
                                           [org.sonatype.pmaven/pmaven-scala 
"0.8-SNAPSHOT"]]}
    :test-dependencies [[junit "4.7"]
                        org.codehaus.groovy/groovy]
    :modules ["pmaven-common" "pmaven-maven-plugin" "pmaven-groovy" 
"pmaven-yaml" "pmaven-clojure" "pmaven-jruby" "pmaven-scala" "pmaven-cli" 
"pmaven-commands"]
    :default-goal "install"
    :plugins [[org.apache.maven.plugins/maven-surefire-plugin "2.5" 
:redirectTestOutputToFile true
                                                                    :forkMode 
"once"
                                                                    :argLine 
"-ea"
                                                                    
:failIfNoTests false
                                                                    
:workingDirectory "${project.build.directory}"
                                                                    :excludes 
["**/Abstract*.java" "**/Test*.java"]
                                                                    :includes 
["**/*Test.java"]]
              [org.apache.maven.plugins/maven-compiler-plugin "2.0.2" :source 
"1.5" :target "1.5"]
              [org.codehaus.gmaven/gmaven-plugin "1.2" :providerSelection "1.7"
                [:default [["generateStubs" "compile" "generateTestStubs" 
"testCompile"]]]]
              [org.codehaus.plexus/plexus-component-metadata "1.5.1"
                [:default [["generate-metadata" "generate-test-metadata"]]]]
              [org.apache.maven.plugins/maven-release-plugin "2.0-beta-9" 
:useReleaseProfile false
                                                                          
:goals "deploy"
                                                                          
:arguments "-B -Prelease"
                                                                          
:autoVersionSubmodules true]
              [org.apache.maven.plugins/maven-scm-plugin "1.2"]])

------------------------------------------------------------------

Note that dependencies without version numbers aren't wrapped in vectors. This 
is very common in child modules because the parent specifies the version 
numbers, as shown above in the dependency-management section.

Things such as :packaging have sensible defaults (in that case, "jar"), and if 
:model-version and :add-default-plugins is omitted then it will assume it is a 
leiningen project.clj. Therefore leiningen input files are valid polyglot maven 
input files. It isn't 100% or bidirectionally interoperable because a) 
leiningen plugins don't work and b) leiningen can't take the full format. Given 
all of the above, the following leiningen project.clj would be valid input to 
polyglot maven:

------------------------------------------------------------------

(defproject org.clojars.the-kenny/clojure-couchdb "0.2"
 :description "Simple Clojure interface to Apache CouchDB, fork of the original 
project with function arguments instead of *server* and some other changes."
 :dependencies [[org.clojure/clojure "1.1.0-master-SNAPSHOT"]
                [org.clojure/clojure-contrib "1.0-SNAPSHOT"]
                [org.clojure/clojure-http-client "1.0.0-SNAPSHOT"]]
 :dev-dependencies [[lein-clojars "0.5.0-SNAPSHOT"]
                    [org.clojure/swank-clojure "1.0"]])

------------------------------------------------------------------

There's one wrinkle to do with :dev-dependencies, which need to be ignored, but 
that's trivial.

Opinions on any of this? As long as plugins could be written in Clojure (and 
Scala/Ruby/Groovy presumably), would current leiningen users use polyglot maven?

Antony Blakey
--------------------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

Reflecting on W.H. Auden's contemplation of 'necessary murders' in the Spanish 
Civil War, George Orwell wrote that such amorality was only really possible, 
'if you are the kind of person who is always somewhere else when the trigger is 
pulled'.
  -- John Birmingham, "Appeasing Jakarta"


-- 
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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to