# Uberjar with depstar

**URL:** https://clojureverse.org/t/uberjar-with-depstar/6394
**Category:** Troubleshooting
**Created:** [August 12, 2020, 7:28pm UTC](https://clojureverse.org/t/uberjar-with-depstar/6394 "2020-08-12T19:28:36Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![iyedb](https://clojureverse.org/user_avatar/clojureverse.org/iyedb/32/1719_2.png) [@iyedb](https://clojureverse.org/u/iyedb)
#### Post date: [August 12, 2020, 7:28pm UTC](https://clojureverse.org/t/uberjar-with-depstar/6394/1 "2020-08-12T19:28:36Z")

</div>

Hi All,  
I have a project using Clojure cli tools clj and deps.edn. I use @seancorfield depstar to build an uber jar:

```auto
 :uberjar {:extra-deps {seancorfield/depstar {:mvn/version "1.0.94"}} 
              :extra-paths ["resources"] 
              :main-opts ["-m" "hf.depstar.uberjar" "foo.jar"
                            "-C" "-m" "foo.core"]}

```

I have a `resources` folder at the root of my project that contains files read by functions in my code. I expected the uberjar to include the resources folder as is in the jar, but the contents are copied at the root of jar when inspecting it with `jar -tf foo.jar`. Which means `(-> "resources/conf.edn" slurp ...)` fails with `java.io.FileNotFoundException: resources/conf.edn` when running the jar produced with uberjar.  
What can I do to access the files in the resources folder when using the repl and when the code references the files when executing the jar.  
What do you recommend.  
Thanks in advance.

---

<div class="post-metadata">

### Author: ![seancorfield](https://clojureverse.org/user_avatar/clojureverse.org/seancorfield/32/195_2.png) [@seancorfield](https://clojureverse.org/u/seancorfield)
#### Post date: [August 12, 2020, 8:19pm UTC](https://clojureverse.org/t/uberjar-with-depstar/6394/2 "2020-08-12T20:19:46Z")

</div>

That is the correct behavior. You would normally have `src` and `resources` on your classpath for _development_ and use `io/resource` to access files via their relative path from the classpath.

`slurp` is going to try to read from the _file system_ if you just give it a string – which won’t read files from the classpath anyway since it will try to read files _outside_ of the JAR file. `slurp` would read (external) files relative to wherever the JAR was run.

Here’s a REPL session that might help clarify this:

```clojure
user=> (require '[clojure.java.io :as io])
nil
user=> (io/resource "deps.edn") ; deps.edn is not on the classpath...
nil ; ... so this returns nil
user=> (slurp "deps.edn") ; slurp can read it from the current directory:
"{:aliases\n {:test-deps\n {:extra-deps\n {bidi/bidi {},\n..."

user=> (io/resource "wsadmin.edn") ; wsadmin.edn is on my classpath...
#object[java.net.URL 0xf26cd76 "file:/Developer/workspace/wsmain/clojure/wsadmin-auth/resources/wsadmin.edn"] ; ...so this returns non-nil...
user=> (slurp (io/resource "wsadmin.edn")) ; ...and I can slurp from a resource...
"{:azure {:client-id \"...\"\n :secret \"...\"\n :tenant-name \"...\"\n..."

user=> (slurp "wsadmin.edn") ; wsadmin.edn is not in the current directory...
;; ...so this fails:
Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2).
wsadmin.edn (No such file or directory)
user=> 

```

---

<div class="post-metadata">

### Author: ![iyedb](https://clojureverse.org/user_avatar/clojureverse.org/iyedb/32/1719_2.png) [@iyedb](https://clojureverse.org/u/iyedb)
#### Post date: [August 12, 2020, 8:39pm UTC](https://clojureverse.org/t/uberjar-with-depstar/6394/3 "2020-08-12T20:39:43Z")

</div>

> [@seancorfield](#):
>
> `io/resource`

It works great. Thank you !

> [@seancorfield](#):
>
> That is the correct behavior

I wrongly expected … 🙂

---

<div class="post-metadata">

### Author: ![seancorfield](https://clojureverse.org/user_avatar/clojureverse.org/seancorfield/32/195_2.png) [@seancorfield](https://clojureverse.org/u/seancorfield)
#### Post date: [August 12, 2020, 8:51pm UTC](https://clojureverse.org/t/uberjar-with-depstar/6394/4 "2020-08-12T20:51:55Z")

</div>

> [@iyedb](#):
>
> I wrongly expected

No worries: the difference between files and resources tends to catch almost everyone out when they first start building uberjars with Clojure (with Leiningen, with Boot, or with `depstar`).

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [February 11, 2021, 8:51am UTC](https://clojureverse.org/t/uberjar-with-depstar/6394/5 "2021-02-11T08:51:57Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
