| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
| icon | lucide/toolbox |
|---|
Create Clojure CLI configured projects, either built-in or practicalli/project-templates to provide REPL Reloaded tools and production-level CI workflows.
Default values (can be over-ridden on the command line)
| Command | Description |
|---|---|
| clojure -T:project/create :template app :name domain/app-name | A simple application |
| clojure -T:project/create | Practicalli application called playground |
| clojure -T:project/create :template practicalli/service | Practicalli Service called playground |
:project/new uses clj-new which is an archived project, although can still be used to create projects using Leiningen style templates. A Clojure CLI configuration must be manually added if these templates do not provide one.
| Command | Description |
|---|---|
| clojure -T:project/new :template app :name practicalli/my-application | App project with given name |
| clojure -T:project/new :template luminus :name practicalli/full-stack-app :args '["+http-kit" "+h2"]' | Luminus project with given name and template options |
| clojure -T:project/new :template figwheel-main :name practicalli/landing-page :args '["--reagent"]' | ClojureScript Figwheel-main project with reagent |
Run project using clojure.main with or without an alias:
clojure -M:alias-name -m domain.app-name
clojure -M -m domain.app-nameThe -M flag specified running the Clojure code with clojure.main library, so -M' is required even if an alias is not included in the running of the application. A warning will be displayed if the -M option is missing.
In the project deps.edn file it could be useful to define an alias to run the project, specifying the main namespace, the function to run and optionally any default arguments that are passed to that function.
:project/run
{:ns-default domain.main-namespace
:exec-fn -main
:exec-args {:port 8888}}Then the project can be run using clojure -X:project/run and arguments can optionally be included in this command line, to complement or replace any default arguments in exec-args.
| Command | Description |
|---|---|
| clojure -M:project/check | detailed report of compilation errors for a project |
| clojure -M:search/libraries library-name | fuzzy search Maven & Clojars |
| clojure -M:search/libraries -F:save library-name | fuzzy search Maven & Clojars and save to project deps.edn |
| clojure -T:search/outdated | report newer versions for maven and git dependencies |
| clojure -M:search/outdated-mvn | check for newer dependencies (maven only) |
:search/libraries will show warnings about unqualified libraries the first time it is used, which can safely be ignored
Carve - static analysis of code (clj-kondo) and remove or report unused vars
| Command | Description |
|---|---|
| clojure -M:project/unused --opts '{:paths ["src" "test"]}' | remove unused vars from the src and test paths |
| clojure -M:project/unused --opts '{:paths ["src" "test"] :report {:format :text}}' | report unused vars from the src and test paths |
Generate report in a file:
clojure -M:project/unused --opts '{:paths ["src" "test"] :report {:format :ignore}}' > .carve/ignoretools.build is a library for creating scripts to manage packaging the projects to a fine level of control. Projects start with common tasks for builind a jar or uberjar from the project.
Deploy a library jar locally using the built-in :deps alias of Clojure CLI or to Clojars.org using slipset/deps-deploy project.
| Command | Description |
|---|---|
| clojure -X:deps mvn-install :jar '"project.jar"' | deploy jar file to local maven repository, i.e. ~/.m2/repository |
| clojure -M:project/clojars project.jar | deploy jar file to Clojars |
| clojure -M:project/clojars-signed project.jar | deploy signed jar file to Clojars |
Set Clojars username/token in CLOJARS_USERNAME and CLOJARS_PASSWORD environment variables.
Set fully qualified artifact-name and version in project pom.xml file
Path to project.jar can also be set in alias to simplify the Clojure command.
clojure -X:deps mvn-install :jar '"project.jar"' for local deployment of jars is part of the 1.10.1.697 release of the Clojure CLI in September 2020.
Tools to search through code and libraries
A fuzzy search for a library by name, passing multiple names to search for
clojure -M:search/libraries http-kit ring compojureAdd the matching library as a dependency into the project deps.edn file
clojure -M:search/libraries --format:merge http-kit
Include Java source on the classpath to look up Java Class and method definitions, eg. cider-find-var in Emacs
Requires: Java sources installed locally (e.g. "/usr/lib/jvm/openjdk-21/lib/src.zip")
Use the aliases with either -A, -M or -X execution options on the Clojure command line.
Clone clojure/clojure repository. Clojure core Java source code in src/jvm/clojure/lang/
Clojure spec, generators and test.check
Static analysis tools to help maintain code quality and suggest Clojure idioms.
| Command | Description |
|---|---|
| clojure -M:lint/clj-kondo | comprehensive and fast static analysis lint tool |
| clojure -M:lint/eastwood | classic lint tool for Clojure |
| clojure -M:lint/idiom | Suggest idiomatic Clojure code |
Create Graphviz graphs of project and library dependencies
Install Graphviz to generate PNG and SVG images. Or use the Edotor website to convert .dot files to PNG or SVG images and select different graph layout engines.
Generate dependency graphs for Vars in Clojure & ClojureScript namespaces
Use -f command line argument to over-ride file type created, i.e -f png
Vizns creates graphs of relationships between namespaces and their dependencies
Other options described in the visns project readme:
Visualise the relationships between dependencies in the project (or given deps.edn configuration). Shows the fully qualified name of a dependency, its version and size.
Generate a PNG image from the project deps.edn configuration and save to project-dependencies-graph.png file
clojure -T:graph/depsOptions available
:security/nvd-scan and :security/ndv-fix adds clj-watson tool
The alias requires an API Key to access the NIST National Vulnerability Database (NVD).
CLJ_WATSON_NVD_API_KEY environment variable should be set to the value of the API Key, e.g via .bashrc or .zshenv file.
| Command | Description |
|---|---|
| clojure -T:security/nvd-scan | check all libraries on the class path for security vulnerabilities |
| clojure -T:security/nvd-fix | update all libraries on the class path for security vulnerabilities |
clj-watson-action can be used in a GitHub workflow to run security vulnerability checks
| Back | FazBrowse Home | New Git URL |