RickMoynihan / pom-update

Automate updating your Clojure libraries pom.xml in tools.deps based projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pom-update

A simple tool for use with tools.deps and the clojure command line tools, to update a pom.xml file with overriden values provided by either :exec-args data or via the command line.

It is suitable for clojure -X invocation and usage as a small library.

It is hoped that this library will soon be made redundant by tools.build a rumoured build tool by the Clojure core team.

FAQ

What should I use this for?

Automatically updating metadata in a Clojure libraries pom.xml, typically setting the maven version and scm tag to a build number provided by your CI system.

Can't I just use clojure -Spom or clojure -X:deps mvn-pom?

Yes if you don't mind manually deploying library changes and setting the version number yourself.

If you want to automate the deployment to deploy your clojure library with a version number determined by CI (e.g. the BUILD_ID or a commit SHA) then you probably want to use this simple tool to assist.

Tools deps almost has the functionality to do this, however with tools.build on the horizon it's not a feature they care to prioritise.

Usage

Add rickmoynihan/pom-update {:mvn/version "0.1.6"} to an appropriate alias in your deps.edn, e.g.

{:deps { ,,, ,,, }
 :aliases {
   :update-version {
     :extra-deps {rickmoynihan/pom-update {:mvn/version "0.1.6"}}
     :exec-fn rickmoynihan.pom/update
     :exec-args {:pom/write-strategy :overwrite
                 :pom/input-file "pom.xml"}}}}

Then at build time, prior to creating a jar for your library run the following command:

clojure -X:update-version :mvn/version "\"$BUILD_NUMBER\"" :scm/tag "\"$BUILD_NUMBER\""

You may also wish to automate calling clojure -X:deps mvn-pom prior to the above call (to ensure dependencies etc are synced properly from deps.edn into pom.xml). If you don't do this you'll need to make sure you commit pom.xml after each meaningful update to your deps.edn.

Other libraries

This library is intended to work with depstar for building library jars, and deps-deploy for deploying them to either clojars or a private maven repository.

License

Copyright © 2020 Rick Moynihan

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

About

Automate updating your Clojure libraries pom.xml in tools.deps based projects

License:Eclipse Public License 1.0


Languages

Language:Clojure 92.5%Language:Shell 7.5%