Liking cljdoc? Tell your friends :D

clojars

pbuilder

pbuilder is a high level wrapper for Badigeon, can:

  • Compile Java sources

  • AOT compile Clojure sources

  • Package a project as a jar, war file

  • Install jar, war files to the local maven repository

  • Install jar, war files to remote maven repository

  • Sign jar, war 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: pbuilder was not tested on Windows! Make sure that unix tools are available in Windows in the %PATH% (chmod, make, tar etc)

Templates

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

Manual configuration

pbuilder can also be configured manually.

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

     :pbuilder {:extra-deps {org.rssys/pbuilder {:mvn/version "0.2.2"}}
                :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:

Note: The juxt/aero library is supported

{
 ;;: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.2.2-SNAPSHOT"                ;; or e.g. #env ARTIFACT_VERSION
 ;;:overwrite-version-file      "VERSION"                     ;; overwrite this file during bump
 :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.sql"]

 ;;:distribution-management     {
 ;;                              :repository {
 ;;                                           :id  "releases"
 ;;                                           :url "http://mycompany/nexus/content/repositories/releases"}
 ;;                              :snapshot-repository
 ;;                                          {
 ;;                                           :id  "snapshots"
 ;;                                           :url "http://mycompany/nexus/content/repositories/snapshots"
 ;;                                           }
 ;;                              }

 }

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? These fine people already did:
Mike Ananev, Oleg & Ilshat Sultanov
Edit on GitHub

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

× close