Liking cljdoc? Tell your friends :D

license clojars

Library template

Intro

This Library template helps you to quick start new library project using clojure deps cli and clj-new.

This Library template provides:

  • project control via Justfile (see just) and scripting using babashka;

  • environment variables control using direnv utility;

  • editor configuration via .editorconfig file;

  • configured clj-kondo linter;

  • configured cljstyle formatter;

  • run tests using kaocha.

This template will give you the following basic project workflow:

mike@mbp02 just
List of available recipes
Available recipes:
    build              # Build deployable jar file of this project
    bump level='patch' # Bump version artifact in `version_id` file, level may be one of: major, minor, patch, alpha, beta, rc, release.
    clean              # Clean target folder
    default            # Help
    deploy             # Deploy this library to Clojars
    format             # Format source code
    install            # Install deployable jar locally (requires the pom.xml file)
    lint               # Lint source code
    outdated           # Check for outdated dependencies
    repl               # Run Clojure repl
    requirements       # Install project requirements (OS will be detected automatically)
    test               # Run tests

See also:

Using Library template

New library project

Before creating a project from this template, please install prerequisites (see below). To create a project from this template just run:

    clojure -X:clj-new :template rssyslib :name myname/myproject
    cd myproject

where :clj-new is alias in ~/.clojure/deps.edn file (see prerequisites below).

Please, see README.adoc in a root folder of created project to install other tools once.

Install prerequisites

All these tools you need to install only once.

  1. Install clojure deps cli tools

    1. MacOS

      brew install clojure/tools/clojure
    2. Linux

      Ensure that the following dependencies are installed in OS: bash, curl, rlwrap, and Java.

      curl -O https://download.clojure.org/install/linux-install-1.10.2.790.sh
      chmod +x linux-install-1.10.2.790.sh
      sudo ./linux-install-1.10.2.790.sh
  2. Install latest clj-new library to a file ~/.clojure/deps.edn

    {
     :aliases {
               :clj-new     {:extra-deps {seancorfield/clj-new {:mvn/version "1.1.243"}}
                             :exec-fn    clj-new/create}
              }
    
     }
  3. Install just utility

    1. MacOS

      brew install just
    2. Linux

      wget https://github.com/casey/just/releases/download/v0.8.3/just-v0.8.3-x86_64-unknown-linux-musl.tar.gz
      
      tar -zxvf just-v0.8.3-x86_64-unknown-linux-musl.tar.gz just
      
      sudo mv ./just /usr/local/bin
  4. Install babashka

    1. MacOS

      brew install borkdude/brew/babashka
    2. Linux

      sudo bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)

Managing this project

Clean project

To clean target folder run:

just clean

Bump artifact version

To set release version run:

just bump release

To update patch version run:

just bump patch

Build project

To build this library template run:

just build

This command will produce deployable jar file and update the generated pom.xml file to keep the dependencies synchronized with your deps.edn file. You can update the version information in the pom.xml using the version_id file.

Install artifact

To install jar file to local .m2 run:

just install

Deploy artifact

To deploy jar file to Clojars run:

just deploy

Check .env.private file for correct values of user and password.

Check old dependencies

To check project for outdated dependencies run:

just outdated

License

Copyright © 2021 Mike Ananev
Distributed under the Eclipse Public License 2.0 or (at your option) any later version.

Can you improve this documentation?Edit on GitHub

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

× close