Disclaimer: The following is not tested. It is just from what I saw from
your description and what caught my attention.
There are special naming rules for the file in a namespace. The first
thing to do is to fix the naming. I would use the following layout.
(Note: I would drop the symlinking for the moment, take make things
easier to spot. Just put the files somewhere in the classpath.)
bar/bar.clj:
> (ns bar
> (:refer-clojure)
> (:load-resources "foo.clj"))
Note: I renamed tst-pkg.clj to bar.clj and put it in a subdirectory,
since this is the place, where use and require look for the file.
(require 'bar) -> file: bar/bar.clj.
Also note: I removed the mycode subdirectory from the load-resources,
since load-resources looks in the namespace-directory for relative
pathnames.
bar/foo.clj:
> (in-ns 'bar)
> (defn foo
> []
> :foo-called)
Just the foo function. Note: I don't use clojure/defn. bar.clj refers to
clojure and this should be the starting point, when using the lib. Later
one can reload foo.clj w/o problems, eg. for debugging or during
development. But the initial load has to be done via bar.clj, cause here
are the dependencies defined!
Now we are ready to use it:
> (require 'bar)
> (bar/foo)
I think your problems should be solved now, since in my understanding
they arise due to the non-adherence to the required file layout.
> java.io.FileNotFoundException: Could not locate Clojure resource
> on classpath: bar/mycode/test.clj
^^^
load-resources works namespace directory relative for relative
pathnames!
So, should the above work, it's time to bring in the symlinking again.
And you should check, whether it still works. If not, there is some
issue with finding files in symlinked classpaths. But to be honest I
don't think so. I also use a symlinked classpath for local projects of
mine and never had any problems.
Hope this helps.
Sincerely
Meikel