Giter VIP home page Giter VIP logo

uberdeps's Introduction

Uberjar builder for deps.edn projects

Takes deps.edn and packs an uberjar out of it.

  • Fast: Does not unpack intermediate jars on disk.
  • Explicit: Prints dependency tree. Realize how much crap you’re packing.
  • Standalone: does not depend on current classpath, does not need live Clojure environment.
  • Embeddable and configurable: fine-tune your build by combining config options and calling specific steps from your code.

Usage

Add to your bash aliases:

clj -Sdeps '{:deps {uberdeps {:mvn/version "0.1.3"}}}' -m uberdeps.uberjar

Or add to your deps.edn or ~/.clojure/deps.edn:

:aliases {
  :uberjar {:extra-deps {uberdeps {:mvn/version "0.1.3"}}
            :main-opts ["-m" "uberdeps.uberjar"]}}
}

Supported command-line options are:

--deps-file <file>                Which deps.edn file to use to build classpath. Defaults to 'deps.edn'
--aliases <alias:alias:...>       Colon-separated list of alias names to include from deps file. Defaults to nothing
--target <file>                   Jar file to ouput to. Defaults to 'target/<directory-name>.jar'
--level (debug|info|warn|error)   Verbose level. Defaults to debug

Programmatic API

(require '[uberdeps.api :as uberdeps])

(let [exclusions (into uberdeps/exclusions [#"\.DS_Store" #".*\.cljs" #"cljsjs/.*"])
      deps       (clojure.edn/read-string (slurp "deps.edn"))]
  (binding [uberdeps/exclusions exclusions
            uberdeps/level      :warn]
    (uberdeps/package deps "target/uber.jar" {:aliases #{:uberjar}})))

Using the generated uberjar

If your project has a -main function, you can run it from within the generated uberjar:

java -cp target/<your project>.jar clojure.main -m <your namespace with main>

Changelog

0.1.3 - May 30, 2019

  • Fixed NPE when target is located in current dir #7

0.1.2 - May 27, 2019

  • Make target dirs if don’t exist #4

0.1.1 - May 3, 2019

  • Normalize dependencies without namespaces #3

0.1.0 - April 29, 2019

  • Initial version

License

Copyright © 2019 Nikita Prokopov

Licensed under MIT (see LICENSE).

uberdeps's People

Contributors

tonsky avatar jorinvo avatar dm3 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.