Skip to content

wdhowe/clj-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clj-project

A template for starting a clj tools based project.

Overview

Batteries included features:

  • Project dirs/file basics
    • src and test directory structure.
    • .gitignore, build.clj, deps.edn, LICENSE, README.
  • CI/CD: Github Workflow that runs tests and packages.
  • Dependencies: Dependency version checks with 'antq'.
  • Tests: Clojure 'test-runner' from Cognitect.
  • Packaging: Create jars/uberjars with 'clojure.tools.build'.
  • Deploy: Publish jars/uberjars to clojars via 'deps-deploy'.

Execute the -main function

Run the -main function in the namespace/core.clj file:

  • Method 1: Implied -main function in the namespace. Args sent as a list.
clj -M:run-m
  • Method 2: Explicit namespace+function. Args sent as a key value map.
clj -X:run-x

Dependencies

Check for outdated dependencies:

clj -M:outdated

Upgrade outdated dependencies.

clj -M:outdated :upgrade true

Tests

Run tests:

clj -T:build test

Packaging

Test, write pom, and build a JAR.

clj -T:build jar

Test, write pom, and build a uberJAR.

clj -T:build uberjar

Clean packaging area.

clj -T:build clean

Deploy

Deploy jars to clojars:

;; env vars for clojars
CLOJARS_USERNAME=username
CLOJARS_PASSWORD=clojars-token

clj -T:build deploy