Skip to content

Commit c4e9477

Browse files
committed
add info on how to run an uberjar built with tools.build in the guide, #561
1 parent 9e3d853 commit c4e9477

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

content/guides/tools_build.adoc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,26 @@ When preparing an application, it is common to compile the full app + libs and a
140140
:class-dir class-dir})
141141
(b/uber {:class-dir class-dir
142142
:uber-file uber-file
143-
:basis basis}))
143+
:basis basis
144+
:main my.lib.main}))
144145
----
145146

146147
The deps.edn and build execution will look the same as the prior example.
147148

148149
You can create the uber jar build with:
149150

150-
[source,clojure]
151+
[source]
151152
----
152153
clj -T:build uber
153154
----
154155

156+
The output of this build will be an uberjar at `target/lib1-1.2.100-standalone.jar`. That jar contains both a compiled version of this project and all of its dependencies. The uberjar will have a manifest referring to the `my.lib.main` namespaces (which should have a `-main` method) and can be invoked like this:
157+
158+
[source]
159+
----
160+
java -jar target/lib1-1.2.100-standalone.jar
161+
----
162+
155163
== Parameterized builds
156164

157165
In the builds above we did not parameterize any aspect of the build, just chose which functions to call. You may find that it's useful to parameterize your builds to differentiate dev/qa/prod, or version, or some other factor. To account for function chaining at the command line, it is advisable to establish the common set of parameters to use across your build functions and have each function pass the parameters along.

0 commit comments

Comments
 (0)