Liking cljdoc? Tell your friends :D

clojars

pbuilder

Project builder is a high level wrapper for Badigeon, has the following functionality:

  • Compile java sources

  • AOT compile Clojure sources

  • Package a project as a jar file

  • Install jar files to the local maven repository

  • Install jar files to remote maven repository

  • Sign jar files

  • Package a project into a standalone bundle with a start script

  • Package a project as an uberjar file

  • Produce a custom JRE runtime using jlink

Usage

Warning: not tested on Windows! Make sure that unix tools such as chmod, make, tar are available in Windows in the %PATH%.

Templates

Easiest way to use pbuilder is to take a ready template:

Manual configuration

Also pbuilder can be configured manually.

First, add to :aliases section of deps.edn a new pbuilder dependency (see latest version above):

     :pbuilder {:extra-deps {org.rssys/pbuilder {:mvn/version "0.1.10"}}
                :jvm-opts   []
                :main-opts  ["--main" "org.rssys.pbuilder.core"]}

Second, create a file pbuild.edn in the project root. Structure for pbuild.edn is shown below. Keys :main, :standalone-run-script, :excluded-libs and :omit-source? are valid for uberjar/standalone projects only. Here is an example of structure pbuild.edn for this project:

{
 ;;:java-src-folder "java-src"
 ;;:javac-options     ["-target" "1.8" "-source" "1.8" "-Xlint:-options"]

 :warn-on-resource-conflicts? true

 :deploy-signed?              true
 :deploy-repo                 {:id "clojars" :url "https://clojars.org/repo"}
 :deploy-creds                :m2-settings                  ;; :m2-settings or :password-prompt

 :target-folder               "target"
 :group-id                    "org.rssys"
 :artifact-id                 "pbuilder"
 :artifact-version            "0.1.11-SNAPSHOT"
 :main                        "org.rssys.pbuilder.core"
 ;;:omit-source?                true
 ;;:uberjar-filename            "pbuilder.jar"
 :description                 "Project builder is a build tool for Clojure projects with tools.deps."
 :url                         "https://github.com/redstarssystems/pbuilder.git"
 :scm                         {:url "https://github.com/redstarssystems/pbuilder.git"}
 :license                     {:name "EPL-2.0"
                               :url  "https://www.eclipse.org/legal/epl-2.0/"}
 :excluded-libs               #{}                           ;; e.g #{ org.clojure/clojure my.org/lib01}
 ;;:standalone-run-script       "./my-custom-script.sh"
 ;;:manifest                    {"Multi-Release" "true"}    ;; here you may override MANIFEST.MF
 ;; :jlink-options is used when building standalone bundle
 ;; :jlink-options               ["--strip-debug" "--no-man-pages" "--no-header-files" "--compress=2" "--add-modules" "java.base,java.sql"]
 }

To run pbuilder use clojure -A:pbuilder <command>.

List of available commands:

  • clean - clean target folder

  • javac - compile java sources

  • compile - compile clojure code

  • jar - build jar file (as library)

  • uberjar - build standalone executable jar file (uberjar)

  • install - install jar file (library) to local .m2

  • deploy - deploy jar file (library) to clojars.org

  • conflicts - show class conflicts (same name class in multiple jar files)

  • standalone - build standalone bundle uberjar + custom JRE using JDK 9+ jlink.

  • release - release artifact.

  • bump - bump version artifact in build file. E.g: clojure -A:pbuilder bump beta. Parameter should be one of: major, minor, patch, alpha, beta, rc, qualifier

License

Copyright © 2020 Mike Ananev

Distributed under the Eclipse Public License 2.0 or (at your option) any later version.

Third party

Badigeon

Project builder uses Badigeon software https://github.com/EwenG/badigeon

Copyright 2019 Ewen Grosjean.

The use and distribution terms for this software are covered by the Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0)

Leiningen

Project builder uses some code from Leiningen https://github.com/technomancy/leiningen

Source Copyright © 2009-2018 Phil Hagelberg, Alex Osborne, Dan Larkin, and contributors. Distributed under the Eclipse Public License, the same as Clojure uses. See the file COPYING.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close