Skip to content

Instantly share code, notes, and snippets.

@vemv
Created July 20, 2017 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vemv/a8a1cc3622cfc8a2563f981a59e268ad to your computer and use it in GitHub Desktop.
Save vemv/a8a1cc3622cfc8a2563f981a59e268ad to your computer and use it in GitHub Desktop.

Publishing jars to Maven easily

Occasionally one needs to use a hacked .jar:

  • You need to modify a .jar (clojure/java) in-place
  • You built a cljsjs package, and want to upload the generated .jar
  • There's some obscure java .jar that is not in Maven.

Leiningen support for floating jars has never been official, and doesn't seem to work with cljsjs.

So one has to publish the jar to a Maven repo.

Local repos are bit of a hassle, and not shareable either obviously.

This is the easiest approach I could find to upload / depend on an arbitrary jar:

  • Sign up on mymavenrepo.com .
  • Use the following command:
mvn deploy:deploy-file -DgroupId=vemv \
  -DartifactId=react-dates \
  -Dversion=12.2.4-1 \
  -Dpackaging=jar \
  -Dfile=react-dates-12.2.4-1.jar \
  -DrepositoryId=mymavenrepo \
  -Durl=YOUR_MYMAVENREPO_WRITE_URL

That should be it. No password or xml files required!

Then, in project.clj:

:repositories [["vemv" "YOUR_MYMAVENREPO_READ_URL"]]

:dependencies
...
[vemv/react-dates "12.2.4-1"]
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment