Fork me on GitHub
#polylith
<
2022-05-05
>
oly10:05:06

just a quick question regarding resources, should i need to specify resource paths in my bases or only in my components I have a component failing its test due to missing resources, I mentioned this the other day and work around the issue. what I am noticing is it passes in one project but not a second so one of the projects is aware of the resource the second is not

Hukka11:05:42

Well, uh, that depends on where the required resources are. If you need a file from there, something needs to add the path to the classpath

Hukka11:05:55

It can be the component, base or project, depending on the need

Hukka11:05:31

For example we have a component that gets a config file from resources, but the file itself is under projects (different in a different project)

oly11:05:49

well the resources I have in the component, I dont get why one project can see the resource but another can

oly11:05:31

they are both including the component in the deps.edn files using local/root which should make the resources available to both ?

Hukka11:05:10

Could be a case of other stuff they depend on, or perhaps different aliases?

Hukka11:05:56

You could start by double checking the classpath in both projects

oly11:05:12

poly/document-templates  {:local/root "../../components/document-templates"}
So I have that in both deps files which I am expecting to mean the resources from that component would be available to both by adding that line

oly11:05:42

is there a poly way to check the class path for a particular project ?

Hukka11:05:10

I meant that check the actual classpath that clojure tooling calculates for you, just to make sure that there isn't something fishy like misplaces parenthesis or anything like that

Hukka11:05:14

polylith isn't creating the classpath, so it won't have a clue

oly11:05:50

oh I see will try its a bit tricky as its only a test that's affected

Hukka11:05:14

Just a couple of weeks ago I had a surprise of finding stuff in classpath/resources I hadn't added yet, just to check how things work. Turned out that dependency had some extra crap there with same filenames (well, index.html is pretty common filename)

oly11:05:11

I do see this output #object[java.net.URL 0x1dc277f4 "file:components/api-postmark/resources/"]

oly11:05:50

strangely this does not get printed when i run tests from the working project even thought the tests run, could be the test runner is capturing the output though

imre15:05:42

wouldn't the shortest be just #'select given it's a local var?

👍 1
imre15:05:08

stumbled upon it as tools.build's compile-clj seems to be at odds with it

tengstrand15:05:11

Looks like it’s a mistake and that we should use the shorter syntax as you suggest.

imre15:05:13

Thanks for checking. I was wondering if it's some sort of a trick

tengstrand15:05:52

No, no trick!

imre15:05:23

🙂 fair enough. PR went green, feel free to merge when you're happy with it

imre15:05:58

thanks a mill!

👍 1