├── resources └── leiningen │ └── help │ ├── immutant-testing │ └── immutant-deployment ├── .gitignore ├── foo-jms.xml ├── src ├── leiningen │ └── immutant.clj └── immutant │ ├── lein │ └── util.clj │ ├── test.clj │ └── war.clj ├── project.clj ├── README.md ├── test └── leiningen │ └── immutant │ └── war_test.clj ├── docs ├── testing.md └── deployment.md └── LICENSE /resources/leiningen/help/immutant-testing: -------------------------------------------------------------------------------- 1 | ../../../docs/testing.md -------------------------------------------------------------------------------- /resources/leiningen/help/immutant-deployment: -------------------------------------------------------------------------------- 1 | ../../../docs/deployment.md -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | pom.xml* 2 | /lib/ 3 | /classes/ 4 | .lein-failures 5 | .lein-deps-sum 6 | .lein-repl-history 7 | .lein-commands 8 | .last-change 9 | .jline-warn 10 | .nrepl-port 11 | /target/ 12 | lein-immutant*.jar 13 | /test-resources/user-home/.m2 -------------------------------------------------------------------------------- /foo-jms.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/leiningen/immutant.clj: -------------------------------------------------------------------------------- 1 | (ns leiningen.immutant 2 | "Tasks for managing Immutant 2.x projects in a WildFly container." 3 | (:refer-clojure :exclude [test]) 4 | (:require [immutant.war :refer [war]] 5 | [immutant.test :refer [test]] 6 | [leiningen.help :as help])) 7 | 8 | (defn immutant 9 | {:subtasks [#'war #'test]} 10 | ([project] 11 | (help/help project "immutant")) 12 | ([project subtask & options] 13 | (case subtask 14 | "war" (war project options) 15 | "test" (test project options) 16 | (help/help project "immutant")))) 17 | -------------------------------------------------------------------------------- /project.clj: -------------------------------------------------------------------------------- 1 | (defproject lein-immutant "2.1.1-SNAPSHOT" 2 | :description "Leiningen plugin for managing an Immutant project." 3 | :url "https://github.com/immutant/lein-immutant" 4 | :mailing-list {:name "Immutant users list" 5 | :post "immutant-users@immutant.org" 6 | :subscribe "immutant-users-subscribe@immutant.org" 7 | :unsubscribe "immutant-users-unsubscribe@immutant.org"} 8 | :license {:name "Eclipse Public License - v 1.0" 9 | :url "http://www.eclipse.org/legal/epl-v10.html" 10 | :distribution :repo} 11 | :dependencies [[org.clojure/tools.cli "0.3.1"] 12 | [org.immutant/deploy-tools "2.1.0" 13 | :exclusions [leiningen-core]] 14 | [org.immutant/fntest "2.0.10"]] 15 | :exclusions [org.clojure/clojure] 16 | :eval-in-leiningen true 17 | :pedantic :warn 18 | :signing {:gpg-key "BFC757F9"} 19 | :deploy-repositories [["releases" :clojars]] 20 | :min-lein-version "2.4.0") 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lein-immutant 2 | 3 | A [Leiningen](http://leiningen.org/) plugin for using Immutant 2.x 4 | applications with a [WildFly](http://wildfly.org/) application server. 5 | 6 | **Note:** as of Immutant 2.x, you *only* need this plugin if you are 7 | deploying your applications to a WildFly container. See [somewhere] 8 | for more info. 9 | 10 | **Note deux:** this plugin requires Leinigen 2.4.0 or greater. 11 | 12 | ## Installation 13 | 14 | The current version is: 15 | 16 | [lein-immutant "2.1.0"] 17 | 18 | ## Usage 19 | 20 | The plugin currently provides two subtasks: 21 | 22 | * `lein immutant war` - This generates a `.war` file suitable for 23 | deploying to WildFly. See 24 | [deployment help](docs/deployment.md) for details. 25 | 26 | * `lein immutant test` - This deploys the application to WildFly, and 27 | runs the tests. See [the testing help](docs/testing.md) 28 | for details. 29 | 30 | ## License 31 | 32 | Copyright (C) 2011-2015 Red Hat, Inc. 33 | 34 | Licensed under the Eclipse Public License v1.0 35 | -------------------------------------------------------------------------------- /src/immutant/lein/util.clj: -------------------------------------------------------------------------------- 1 | (ns immutant.lein.util 2 | (:require [leiningen.core.main :as lcm] 3 | [leiningen.core.project :as project] 4 | [clojure.tools.cli :as opts] 5 | [clojure.string :as str])) 6 | 7 | (defn options-summary [option-specs] 8 | (:summary (opts/parse-opts [] option-specs))) 9 | 10 | (defn parse-options [args option-specs help-fn] 11 | (let [{:keys [options errors]} 12 | (opts/parse-opts args option-specs) 13 | abort #(lcm/abort (format "%s\n\n%s" % (help-fn)))] 14 | (when errors 15 | (abort (str/join "\n" errors))) 16 | (reduce 17 | (fn [accum [k v]] 18 | (if (.startsWith (name k) "no-") 19 | (let [other (keyword (.substring (name k) 3))] 20 | (when (contains? options other) 21 | (abort (apply format "You can't specify both --%s and --%s" 22 | (map #(-> % name (.replace "?" "")) [k other])))) 23 | (-> accum 24 | (dissoc k) 25 | (assoc other false))) 26 | (assoc accum k v))) {} options))) 27 | 28 | (defn mapply [f & args] 29 | "Applies args to f, and expands the last arg into a kwarg seq if it is a map" 30 | (apply f (apply concat (butlast args) (last args)))) 31 | 32 | (defn extract-profiles [project] 33 | (when-let [profiles (seq (-> project meta :included-profiles))] 34 | (when-not (= profiles 35 | (:default @project/default-profiles)) 36 | (vec profiles)))) 37 | -------------------------------------------------------------------------------- /test/leiningen/immutant/war_test.clj: -------------------------------------------------------------------------------- 1 | (ns leiningen.immutant.war-test 2 | (:refer-clojure :exclude [add-classpath]) 3 | (:require [clojure.test :refer :all] 4 | [clojure.java.io :as io] 5 | [clojure.set :as set] 6 | [immutant.war :refer :all])) 7 | 8 | (defn war-entry-set [f] 9 | (with-open [zip (java.util.zip.ZipFile. f)] 10 | (->> zip 11 | .entries 12 | enumeration-seq 13 | (map (memfn getName)) 14 | set))) 15 | 16 | (defn verify-war [f expected] 17 | (let [a (war-entry-set f)] 18 | (or (= a expected) 19 | (println "FAIL archive diff: missing -" 20 | (set/difference expected a) 21 | "extra -" 22 | (set/difference a expected))))) 23 | 24 | (defn file-from-war [archive name] 25 | (with-open [zip (java.util.zip.ZipFile. archive)] 26 | (let [f (io/file (System/getProperty "user.tmp.dir") name)] 27 | (when-let [entry (some #(and (= (.getName %) name) %) 28 | (enumeration-seq (.entries zip)))] 29 | (io/copy (.getInputStream zip entry) f) 30 | f)))) 31 | 32 | (deftest add-init-fn-should-add--main-if-:main-is-ns 33 | (is (= 'foo.bar/-main 34 | (-> {:main 'foo.bar} 35 | (add-init-fn {}) 36 | :init-fn)))) 37 | 38 | (deftest add-init-fn-should-work-:main-is-fn 39 | (is (= 'foo.bar/baz 40 | (-> {:main 'foo.bar/baz} 41 | (add-init-fn {}) 42 | :init-fn)))) 43 | -------------------------------------------------------------------------------- /docs/testing.md: -------------------------------------------------------------------------------- 1 | To run an application's tests inside of a WildFly container, you can 2 | use the `lein immutant test` task. 3 | 4 | This task runs WildFly, deploys the project to it, runs all tests 5 | found beneath the test/ directory, undeploys the app, and then shuts 6 | down WildFly. All tests specified in the `:test-paths` from 7 | project.clj will be executed. 8 | 9 | The task's behavior can be configured with the following options under 10 | the `[:immutant :test]` path in `project.clj`, all of which can be 11 | overridden via command line switches. 12 | 13 | * `:cluster?` - If true, the application will be deployed to the 14 | default cluster defined in the WildFly domain configuration (which 15 | defaults to two nodes), with the tests being run on one of the nodes. 16 | Defaults to `false`. 17 | 18 | Cluster mode can be specified on the command line as `-c` or 19 | `--cluster`, or disabled with `--no-cluster`. 20 | 21 | * `:debug?` - If true, the server will be started with 22 | remote-debugging enabled. This means it will start, but immediately 23 | suspend, waiting for a remote debugger to attach to port 8787. 24 | 25 | Debug mode can be specified on the command line as `-d` or 26 | `--debug`, or disabled with `--no-debug`. 27 | 28 | * `:jboss-home` - Specifies the path to the WildFly install to be 29 | used. 30 | 31 | The path can be specified on the command line as `-j PATH` or 32 | `--jboss-home PATH`, or via the `$JBOSS_HOME` environment 33 | variable. `$JBOSS_HOME` will only be checked if the path isn't 34 | provided in `project.clj` or via the cli option. 35 | 36 | * `:offset` - The test WildFly instance(s) is started with offset 37 | ports so it won't collide with a dev WildFly you may be running on 38 | the standard ports. By default, the ports are offset by 67. 39 | 40 | The offset can be specified on the command line as `-o OFFSET` or 41 | `--offset OFFSET`. 42 | 43 | If you only want to run a subset of your tests inside or outside of 44 | the container, you can separate the tests in to different 45 | directories, and use profiles to activate the correct tests 46 | in-container. Given the following project.clj snippet: 47 | 48 | :test-paths ["outside-tests"] 49 | :profiles {:inside {:test-paths ^:replace ["inside-tests"]}} 50 | 51 | `lein test` will only run the outside tests, while 52 | `lein with-profile inside immutant test` will only run the inside 53 | tests within WildFly. 54 | 55 | If you want to run all of the tests within WildFly, remove the 56 | `:replace` metadata to have `inside-tests` added to the existing 57 | `:test-paths`. 58 | -------------------------------------------------------------------------------- /src/immutant/test.clj: -------------------------------------------------------------------------------- 1 | (ns immutant.test 2 | (:refer-clojure :exclude [test]) 3 | (:require [leiningen.core.main :refer [abort]] 4 | [leiningen.core.project :as project] 5 | [fntest.core :as fntest] 6 | [clojure.java.io :as io] 7 | [immutant.lein.util :as u] 8 | [immutant.war :refer [war]])) 9 | 10 | (def option-specs 11 | [["-c" "--cluster" 12 | "Deploy the test application to a cluster" 13 | :id :cluster?] 14 | [nil "--no-cluster" 15 | "Deploy the test application to a standalone server (default)" 16 | :id :no-cluster?] 17 | ["-d" "--debug" 18 | "Start the server with debugging enabled" 19 | :id :debug?] 20 | [nil "--no-debug" 21 | "Don't enable debugging on server start (default)" 22 | :id :no-debug?] 23 | ["-j" "--jboss-home PATH" 24 | "Use the WildFly at PATH"] 25 | ["-o" "--offset OFFSET" 26 | "Offset the WildFly network ports" 27 | :parse-fn read-string]]) 28 | 29 | (defn jboss-home [options] 30 | (if-let [home (:jboss-home options (System/getenv "JBOSS_HOME"))] 31 | (if (.exists (io/file home)) 32 | home 33 | (abort (format "jboss home '%s' does not exist." home))) 34 | (abort "No jboss home specified. Specify via --jboss-home or $JBOSS_HOME."))) 35 | 36 | (defn generate-war [project port-file] 37 | (war (update-in project [:immutant :war] 38 | #(-> % 39 | (assoc :dev? true) 40 | (update-in [:nrepl] assoc 41 | :port 0 42 | :host "localhost" 43 | :start? true 44 | :port-file (.getAbsolutePath port-file)))) 45 | nil)) 46 | 47 | (defn help-test [] 48 | (format "%s\n\n%s\n\n%s\n\n%s\n" 49 | "Runs a project's tests inside WildFly." 50 | "Valid options are:" 51 | (u/options-summary option-specs) 52 | "For detailed help, see `lein help immutant testing`.")) 53 | 54 | (defn test 55 | "Runs a project's tests inside WildFly." 56 | [project args] 57 | (let [project (project/merge-profiles project [:leiningen/test :test]) 58 | options (merge 59 | (-> project :immutant :test) 60 | (u/parse-options args option-specs help-test)) 61 | jboss-home (jboss-home options) 62 | port-file (io/file (:target-path project) "fntest-nrepl-port")] 63 | (println 64 | (format 65 | "Running tests inside WildFly (log output available in %s/isolated-wildfly/%s/log/server.log)..." 66 | (:target-path project) 67 | (if (:cluster? options) "domain/servers/*" "standalone"))) 68 | (when-not (u/mapply 69 | fntest/test-in-container 70 | (str (:name project) ".war") 71 | (:root project) 72 | (-> options 73 | (assoc 74 | :profiles (or 75 | (u/extract-profiles project) 76 | [:dev :test]) 77 | :jboss-home jboss-home 78 | :dirs (:test-paths project) 79 | :port-file port-file 80 | :war-file (generate-war project port-file) 81 | :modes fntest/default-modes) 82 | (cond-> 83 | (:cluster? options) (update-in [:modes] conj :domain) 84 | (:debug? options) (update-in [:modes] conj :debug)))) 85 | (abort "Tests failed")))) 86 | -------------------------------------------------------------------------------- /src/immutant/war.clj: -------------------------------------------------------------------------------- 1 | (ns immutant.war 2 | "Generate war files for WildFly." 3 | (:refer-clojure :exclude [add-classpath]) 4 | (:require [leiningen.core.classpath :as cp] 5 | [leiningen.core.main :refer [abort warn]] 6 | [leiningen.uberjar :as uberjar] 7 | [clojure.string :as str] 8 | [clojure.java.io :as io] 9 | [immutant.lein.util :as u] 10 | [immutant.deploy-tools.war :as dt-war])) 11 | 12 | (defn resolve-path [project path] 13 | (if-let [path' (try 14 | (dt-war/resolve-target-path path) 15 | (catch Exception e 16 | (abort (.getMessage e))))] 17 | path' 18 | (io/file (:target-path project)))) 19 | 20 | (def option-specs 21 | [["-d" "--dev" 22 | "Generate a 'dev' war" 23 | :id :dev?] 24 | [nil "--no-dev" 25 | "Generate an uberwar (default)" 26 | :id :no-dev?] 27 | ["-c" "--context-path CONTEXT" 28 | "Deploy to this context path"] 29 | ["-v" "--virtual-host HOST" 30 | "Deploy to the named host defined in the WildFly config"] 31 | ["-o" "--destination DIR" 32 | "Write the generated war to DIR"] 33 | ["-n" "--name NAME" 34 | "Override the name of the war (sans the .war suffix)"] 35 | ["-r" "--resource-paths DIR1,DIR2" 36 | "Paths to file trees to include in the top level of the war" 37 | :parse-fn #(str/split % #",")] 38 | [nil "--nrepl-host HOST" 39 | "Host for nrepl to bind to"] 40 | [nil "--nrepl-port PORT" 41 | "Port for nrepl to bind to" 42 | :parse-fn read-string] 43 | [nil "--nrepl-port-file FILE" 44 | "File to write actual nrepl port to"] 45 | [nil "--nrepl-start" 46 | "Request nrepl to start (default for 'dev' wars)"] 47 | [nil "--no-nrepl-start" 48 | "Don't request nrepl to start (default for uberwars)"]]) 49 | 50 | (defn absolutize [root path] 51 | (.getAbsolutePath 52 | (let [file (io/file path)] 53 | (if (.isAbsolute file) 54 | file 55 | (io/file root file))))) 56 | 57 | (defn coerce-options [options] 58 | (reduce 59 | (fn [m [path coerce-fn]] 60 | (if (get-in m path) 61 | (update-in m path coerce-fn) 62 | m)) 63 | options 64 | (let [absolutize-fn (partial absolutize (:root options))] 65 | {[:war-resource-paths] (partial map absolutize-fn) 66 | [:nrepl :port-file] absolutize-fn}))) 67 | 68 | (defn merge-options 69 | [{:keys [nrepl-host nrepl-port nrepl-port-file nrepl-start] :as options} 70 | project] 71 | (let [merged-opts 72 | (merge-with 73 | #(if (map? %1) 74 | (merge %1 %2) 75 | %2) 76 | {:name "%p%t"} 77 | (-> project :immutant :war) 78 | (update-in options [:nrepl] 79 | #(cond-> % 80 | nrepl-host (assoc :host nrepl-host) 81 | nrepl-port (assoc :port nrepl-port) 82 | nrepl-port-file (assoc :port-file nrepl-port-file) 83 | (contains? options :nrepl-start) (assoc :start? nrepl-start))))] 84 | (if (and (:dev? merged-opts) 85 | (not (-> merged-opts :nrepl (contains? :start?)))) 86 | (assoc-in merged-opts [:nrepl :start?] true) 87 | merged-opts))) 88 | 89 | (defn war-name [project options] 90 | (-> (:name options) 91 | (str/replace #"%p" (:name project)) 92 | (str/replace #"%v" (str "-" (:version project))) 93 | (str/replace #"%t" (if (:dev? options) "-dev" "")) 94 | (str ".war"))) 95 | 96 | (defn add-init-fn [project options] 97 | (if-let [main-ns (:main project)] 98 | (assoc options 99 | :init-fn (if (-> main-ns symbol namespace) 100 | (symbol main-ns) 101 | (symbol (name main-ns) "-main"))) 102 | (do 103 | (warn "No :main specified in project.clj, no app initialization will be performed.") 104 | options))) 105 | 106 | (defn add-uberjar 107 | "Builds and adds the uberjar to the options if we're building an uberwar." 108 | [project options] 109 | (if (:dev? options) 110 | options 111 | (assoc options 112 | :uberjar (io/file (uberjar/uberjar project))))) 113 | 114 | (defn add-classpath 115 | [project options] 116 | (if (:dev? options) 117 | (assoc options 118 | :classpath (cp/get-classpath project)) 119 | options)) 120 | 121 | (defn add-alias [src-path dest-path m] 122 | (assoc-in m dest-path (get-in m src-path))) 123 | 124 | (defn help-war [] 125 | (format "%s\n\n%s\n\n%s\n\n%s\n" 126 | "Generates a war file suitable for deploying to a WildFly container." 127 | "Valid options are:" 128 | (u/options-summary option-specs) 129 | "For detailed help, see `lein help immutant deployment`.")) 130 | 131 | (defn war 132 | "Generates a war file suitable for deploying to a WildFly container." 133 | [project args] 134 | (let [options (-> args 135 | (u/parse-options option-specs help-war) 136 | (merge-options project) 137 | (assoc 138 | :dependency-resolver (partial cp/resolve-dependencies :dependencies) 139 | :dependency-hierarcher (partial cp/dependency-hierarchy :dependencies)) 140 | (->> (add-uberjar project) 141 | (add-init-fn project) 142 | (add-classpath project) 143 | (merge project) 144 | (add-alias [:immutant :war :resource-paths] [:war-resource-paths]) 145 | (add-alias [:repl-options] [:nrepl :options]) 146 | coerce-options)) 147 | file (io/file (resolve-path project (:destination options)) 148 | (war-name project options))] 149 | (try 150 | (dt-war/create-war file options) 151 | (catch Exception e 152 | (abort (str "Error: " (.getMessage e))))) 153 | (println "Created" (.getAbsolutePath file)) 154 | file)) 155 | -------------------------------------------------------------------------------- /docs/deployment.md: -------------------------------------------------------------------------------- 1 | To deploy an Immutant application to WildFly, you'll need to generate 2 | a war file via the `lein immutant war` task. 3 | 4 | The task's behavior can be configured with the following options under 5 | the `[:immutant :war]` path in `project.clj`, all of which can be 6 | overridden via command line switches. 7 | 8 | * `:context-path` - The context path to attach the application to. By 9 | default, the application will use a context based on the name of the 10 | war file, so a war file named `foo.war` will be hosted under `/foo`. 11 | To override that set `:context-path` to the desired context. If you 12 | want the root ('/') context, you can either set `:context-path` to 13 | "/" *or* name the war file `ROOT.war`. 14 | 15 | This value is written to `WEB-INF/jboss-web.xml` inside the war, and 16 | a copy of the file is written to `:target-path`. 17 | 18 | The context path can be specified on the command line as `-c 19 | CONTEXT` or `--context-path CONTEXT`. 20 | 21 | * `:destination` - The directory where the war file should be placed. 22 | To ease deployment to WildFly, you can specify the root of your 23 | WildFly installation and the archive will be placed within the 24 | `standalone/deployments/` directory under that root instead of at 25 | the root. Defaults to `:target-path`. 26 | 27 | The destination can be specified on the command line as `-o DIR` or 28 | `--destination DIR`. 29 | 30 | * `:dev?` - Tells the task to create a development war with the 31 | following characteristics: 32 | 33 | - The application source and resources aren't included in the 34 | archive, and instead are referenced where they are on disk. 35 | - The application's dependencies are also not included, and are 36 | referenced from `~/.m2/`. 37 | - An nREPL endpoint is started on a random port on localhost, 38 | and will have any middleware and `:repl-options` from your 39 | `project.clj` applied. 40 | 41 | The development war allows the `ring.middleware.reload` middleware 42 | to reload changed namespaces on disk, and doesn't require you to 43 | regenerate the war file after making source changes. You will still 44 | need to redeploy the application to see any changes that the reload 45 | middleware can't load, and you'll need to regenerate the war if you 46 | change any dependencies in `project.clj`. 47 | 48 | Defaults to `false`, which results in an uberwar containing all of 49 | the application's code, resources, and dependencies. 50 | 51 | Development mode can be specified on the command line as `-d` or 52 | `--dev`, or disabled with `--no-dev`. 53 | 54 | * `:name` - Specifies the name of the war file (without the .war 55 | suffix). Defaults to `%p%t`, and supports placeholders: 56 | 57 | - `%p` for the project name 58 | - `%v` for project version 59 | - `%t` for the type suffix (which will be -dev for dev wars, "" 60 | for full wars). 61 | 62 | The name can be specified on the command line as `-n NAME` or 63 | `--name NAME`. 64 | 65 | * `:nrepl` - A map that specifies the options for an nREPL endpoint. 66 | 67 | - `:host` - The host to bind to. Defaults to "localhost". 68 | Can be overridden on the command line via `--nrepl-host HOST`. 69 | - `:port` - The port to bind to. Defaults to `0`, which means a 70 | random port. Can be overridden on the command line via 71 | `--nrepl-port PORT`. 72 | - `:port-file` - The file where the nREPL port is written for 73 | tooling to pick up. Can be relative to the app root or absolute, 74 | and *must* be absolute when used with an uberwar. Defaults to both 75 | `.nrepl-port` *and* `:target-path/nrepl-port`, which is the same 76 | as lein's default. Note that when specifying a port file, you can 77 | only specify a single file. Can be overridden on the command line 78 | via `--nrepl-port-file FILE`. 79 | - `:start?` - Controls if an nREPL endpoint is started or not. For 80 | development wars, this is `true` by default, false otherwise. Can 81 | be overridden on the command line via `--nrepl-start`, or disabled 82 | with `--no-nrepl-start`. 83 | 84 | * `:resource-paths` - A vector of directories containing resources 85 | that need to be copied to the top-level of the war file. These 86 | directories are different than the lein-standard :resource-paths, as 87 | those will be included in the war automatically. These directories 88 | are used to override or add configuration to `WEB-INF/` or 89 | `META-INF/` dirrectories within the war. Can be overridden on the 90 | command line via `-r PATH1,PATH2` or `--resource-paths PATH1,PATH2`. 91 | 92 | * `:virtual-host` - The name of a host defined in the WildFly 93 | configuration that has virtual aliases assigned. This likely *won't* 94 | be the actual hostname. See the 95 | [WildFly docs](https://docs.jboss.org/author/display/WFLY8/Undertow+subsystem+configuration) 96 | for more detail. 97 | 98 | This value is written to `WEB-INF/jboss-web.xml` inside the war, and 99 | a copy of the file is written to `:target-path`. 100 | 101 | The host can be specified on the command line as `-v 102 | HOST` or `--virtual-host HOST`. 103 | 104 | 105 | ### Example 106 | 107 | ```clojure 108 | (project my-app "0.1.0" 109 | ... 110 | :immutant { 111 | :war { 112 | ;; the following will generate foo-0.1.0.war, or 113 | ;; foo-0.1.0-dev.war for dev wars. 114 | :name "foo-%v%t" 115 | 116 | ;; Destination defaults to :target-path 117 | :destination "path/for/war/" 118 | 119 | ;; contents placed at the top-level of the jar, useful for 120 | ;; overriding WEB-INF/web.xml, etc. If, after copying these resources, 121 | ;; we don't have a web.xml, we'll add our own. 122 | :resource-paths ["war-resources"] 123 | 124 | :context-path "/" 125 | 126 | ;; not a hostname, but the name of a server configuration 127 | ;; in the WildFly xml 128 | :virtual-host "some-configured-host" 129 | 130 | ;; override the nREPL settings 131 | :nrepl {:host "0.0.0.0" 132 | :port 1234 133 | :port-file "path/to/port/file" 134 | :start? true}}} 135 | 136 | :main my-app.core 137 | ... 138 | ) 139 | ``` 140 | ### Notes 141 | 142 | When generating an uberwar, we generate an uberjar using the standard 143 | lein uberjar task, so all of the options for the uberjar task are 144 | applied. 145 | 146 | For both developer and uber wars, we generate a `WEB-INF/web.xml` that 147 | acts as an entry point in to your application. As a convenience, we 148 | drop a copy of that `web.xml` in to `:target-path` in case you need to 149 | modify it. You'll want to place your copy in a directory in your 150 | application root and point `[:immutant :war :resource-paths]` at it so 151 | it will get picked up. We also generate a 152 | `WEB-INF/jboss-deployment-structure.xml` that specifies what WildFly 153 | modules the application depends on, and drop a copy in 154 | `:target-path`. We do the same for `WEB-INF/jboss-web.xml` if you 155 | specify a `:context-path` or `:virtual-host`. 156 | 157 | For both types of war archives, you'll need to specify a `:main` as 158 | the entry point for your application. 159 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC 2 | LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM 3 | CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 4 | 5 | 1. DEFINITIONS 6 | 7 | "Contribution" means: 8 | 9 | a) in the case of the initial Contributor, the initial code and 10 | documentation distributed under this Agreement, and 11 | 12 | b) in the case of each subsequent Contributor: 13 | 14 | i) changes to the Program, and 15 | 16 | ii) additions to the Program; 17 | 18 | where such changes and/or additions to the Program originate from and are 19 | distributed by that particular Contributor. A Contribution 'originates' from 20 | a Contributor if it was added to the Program by such Contributor itself or 21 | anyone acting on such Contributor's behalf. Contributions do not include 22 | additions to the Program which: (i) are separate modules of software 23 | distributed in conjunction with the Program under their own license 24 | agreement, and (ii) are not derivative works of the Program. 25 | 26 | "Contributor" means any person or entity that distributes the Program. 27 | 28 | "Licensed Patents" mean patent claims licensable by a Contributor which are 29 | necessarily infringed by the use or sale of its Contribution alone or when 30 | combined with the Program. 31 | 32 | "Program" means the Contributions distributed in accordance with this 33 | Agreement. 34 | 35 | "Recipient" means anyone who receives the Program under this Agreement, 36 | including all Contributors. 37 | 38 | 2. GRANT OF RIGHTS 39 | 40 | a) Subject to the terms of this Agreement, each Contributor hereby grants 41 | Recipient a non-exclusive, worldwide, royalty-free copyright license to 42 | reproduce, prepare derivative works of, publicly display, publicly perform, 43 | distribute and sublicense the Contribution of such Contributor, if any, and 44 | such derivative works, in source code and object code form. 45 | 46 | b) Subject to the terms of this Agreement, each Contributor hereby grants 47 | Recipient a non-exclusive, worldwide, royalty-free patent license under 48 | Licensed Patents to make, use, sell, offer to sell, import and otherwise 49 | transfer the Contribution of such Contributor, if any, in source code and 50 | object code form. This patent license shall apply to the combination of the 51 | Contribution and the Program if, at the time the Contribution is added by the 52 | Contributor, such addition of the Contribution causes such combination to be 53 | covered by the Licensed Patents. The patent license shall not apply to any 54 | other combinations which include the Contribution. No hardware per se is 55 | licensed hereunder. 56 | 57 | c) Recipient understands that although each Contributor grants the licenses 58 | to its Contributions set forth herein, no assurances are provided by any 59 | Contributor that the Program does not infringe the patent or other 60 | intellectual property rights of any other entity. Each Contributor disclaims 61 | any liability to Recipient for claims brought by any other entity based on 62 | infringement of intellectual property rights or otherwise. As a condition to 63 | exercising the rights and licenses granted hereunder, each Recipient hereby 64 | assumes sole responsibility to secure any other intellectual property rights 65 | needed, if any. For example, if a third party patent license is required to 66 | allow Recipient to distribute the Program, it is Recipient's responsibility 67 | to acquire that license before distributing the Program. 68 | 69 | d) Each Contributor represents that to its knowledge it has sufficient 70 | copyright rights in its Contribution, if any, to grant the copyright license 71 | set forth in this Agreement. 72 | 73 | 3. REQUIREMENTS 74 | 75 | A Contributor may choose to distribute the Program in object code form under 76 | its own license agreement, provided that: 77 | 78 | a) it complies with the terms and conditions of this Agreement; and 79 | 80 | b) its license agreement: 81 | 82 | i) effectively disclaims on behalf of all Contributors all warranties and 83 | conditions, express and implied, including warranties or conditions of title 84 | and non-infringement, and implied warranties or conditions of merchantability 85 | and fitness for a particular purpose; 86 | 87 | ii) effectively excludes on behalf of all Contributors all liability for 88 | damages, including direct, indirect, special, incidental and consequential 89 | damages, such as lost profits; 90 | 91 | iii) states that any provisions which differ from this Agreement are offered 92 | by that Contributor alone and not by any other party; and 93 | 94 | iv) states that source code for the Program is available from such 95 | Contributor, and informs licensees how to obtain it in a reasonable manner on 96 | or through a medium customarily used for software exchange. 97 | 98 | When the Program is made available in source code form: 99 | 100 | a) it must be made available under this Agreement; and 101 | 102 | b) a copy of this Agreement must be included with each copy of the Program. 103 | 104 | Contributors may not remove or alter any copyright notices contained within 105 | the Program. 106 | 107 | Each Contributor must identify itself as the originator of its Contribution, 108 | if any, in a manner that reasonably allows subsequent Recipients to identify 109 | the originator of the Contribution. 110 | 111 | 4. COMMERCIAL DISTRIBUTION 112 | 113 | Commercial distributors of software may accept certain responsibilities with 114 | respect to end users, business partners and the like. While this license is 115 | intended to facilitate the commercial use of the Program, the Contributor who 116 | includes the Program in a commercial product offering should do so in a 117 | manner which does not create potential liability for other Contributors. 118 | Therefore, if a Contributor includes the Program in a commercial product 119 | offering, such Contributor ("Commercial Contributor") hereby agrees to defend 120 | and indemnify every other Contributor ("Indemnified Contributor") against any 121 | losses, damages and costs (collectively "Losses") arising from claims, 122 | lawsuits and other legal actions brought by a third party against the 123 | Indemnified Contributor to the extent caused by the acts or omissions of such 124 | Commercial Contributor in connection with its distribution of the Program in 125 | a commercial product offering. The obligations in this section do not apply 126 | to any claims or Losses relating to any actual or alleged intellectual 127 | property infringement. In order to qualify, an Indemnified Contributor must: 128 | a) promptly notify the Commercial Contributor in writing of such claim, and 129 | b) allow the Commercial Contributor tocontrol, and cooperate with the 130 | Commercial Contributor in, the defense and any related settlement 131 | negotiations. The Indemnified Contributor may participate in any such claim 132 | at its own expense. 133 | 134 | For example, a Contributor might include the Program in a commercial product 135 | offering, Product X. That Contributor is then a Commercial Contributor. If 136 | that Commercial Contributor then makes performance claims, or offers 137 | warranties related to Product X, those performance claims and warranties are 138 | such Commercial Contributor's responsibility alone. Under this section, the 139 | Commercial Contributor would have to defend claims against the other 140 | Contributors related to those performance claims and warranties, and if a 141 | court requires any other Contributor to pay any damages as a result, the 142 | Commercial Contributor must pay those damages. 143 | 144 | 5. NO WARRANTY 145 | 146 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON 147 | AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER 148 | EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR 149 | CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A 150 | PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the 151 | appropriateness of using and distributing the Program and assumes all risks 152 | associated with its exercise of rights under this Agreement , including but 153 | not limited to the risks and costs of program errors, compliance with 154 | applicable laws, damage to or loss of data, programs or equipment, and 155 | unavailability or interruption of operations. 156 | 157 | 6. DISCLAIMER OF LIABILITY 158 | 159 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY 160 | CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, 161 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION 162 | LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 163 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 164 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE 165 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY 166 | OF SUCH DAMAGES. 167 | 168 | 7. GENERAL 169 | 170 | If any provision of this Agreement is invalid or unenforceable under 171 | applicable law, it shall not affect the validity or enforceability of the 172 | remainder of the terms of this Agreement, and without further action by the 173 | parties hereto, such provision shall be reformed to the minimum extent 174 | necessary to make such provision valid and enforceable. 175 | 176 | If Recipient institutes patent litigation against any entity (including a 177 | cross-claim or counterclaim in a lawsuit) alleging that the Program itself 178 | (excluding combinations of the Program with other software or hardware) 179 | infringes such Recipient's patent(s), then such Recipient's rights granted 180 | under Section 2(b) shall terminate as of the date such litigation is filed. 181 | 182 | All Recipient's rights under this Agreement shall terminate if it fails to 183 | comply with any of the material terms or conditions of this Agreement and 184 | does not cure such failure in a reasonable period of time after becoming 185 | aware of such noncompliance. If all Recipient's rights under this Agreement 186 | terminate, Recipient agrees to cease use and distribution of the Program as 187 | soon as reasonably practicable. However, Recipient's obligations under this 188 | Agreement and any licenses granted by Recipient relating to the Program shall 189 | continue and survive. 190 | 191 | Everyone is permitted to copy and distribute copies of this Agreement, but in 192 | order to avoid inconsistency the Agreement is copyrighted and may only be 193 | modified in the following manner. The Agreement Steward reserves the right to 194 | publish new versions (including revisions) of this Agreement from time to 195 | time. No one other than the Agreement Steward has the right to modify this 196 | Agreement. The Eclipse Foundation is the initial Agreement Steward. The 197 | Eclipse Foundation may assign the responsibility to serve as the Agreement 198 | Steward to a suitable separate entity. Each new version of the Agreement will 199 | be given a distinguishing version number. The Program (including 200 | Contributions) may always be distributed subject to the version of the 201 | Agreement under which it was received. In addition, after a new version of 202 | the Agreement is published, Contributor may elect to distribute the Program 203 | (including its Contributions) under the new version. Except as expressly 204 | stated in Sections 2(a) and 2(b) above, Recipient receives no rights or 205 | licenses to the intellectual property of any Contributor under this 206 | Agreement, whether expressly, by implication, estoppel or otherwise. All 207 | rights in the Program not expressly granted under this Agreement are 208 | reserved. 209 | 210 | This Agreement is governed by the laws of the State of New York and the 211 | intellectual property laws of the United States of America. No party to this 212 | Agreement will bring a legal action under this Agreement more than one year 213 | after the cause of action arose. Each party waives its rights to a jury trial 214 | in any resulting litigation. 215 | --------------------------------------------------------------------------------