Fork me on GitHub
#polylith
<
2023-04-27
>
kpav18:04:34

What is the correct structure for resource* directories regarding poly check? Ive got a base with resources/, dev-resources/, and test-resources/. For some reason, poly check only gives me Warning 205: Non. top namespace ...for files in the top level of test-resources/, not any of the other directories.

kpav18:04:50

I was able to fix it by having the files live in test-resouces/my/ns/ , but I would prefer to have everything at the top level without the extra folder nesting

furkan3ayraktar12:04:20

Resources are put into the same place when a classpath is created. This is not related to Polylith; it is the default behavior of Clojure/Java. Because of this, we recommend to place resources under each brick’s resources directory with a top directory named same as the component’s name. So it could look like:

my-ws
├── components
|   ├── foo
|   |   ├─ resources
|   |   |  └─ foo
|   |   |     ├─ some-file
|   |   |     └─ some-other-file
|   |   ├─ src
|   |   └─ test
|   ├── bar
|   |   ├─ resources
|   |   |  └─ bar
|   |   |     ├─ some-file
|   |   |     └─ some-other-file
|   |   ├─ src
|   |   └─ test

imre13:04:15

this is a way to avoid clashes when you then use multiple components in a project

kpav15:04:20

So, that folder structure works with all the resource folders except specifically test-resources for some reason -- to go by that example, bases/foo/test-resources/foo/example.txt gives me the 205, while bases/foo/dev-resources/foo/example.txt is fine. Both folders are specified in :extra-paths for the :dev and :test aliases in the base and root deps.edn files as well. I'm going to try to start a fresh polylith workspace to see if I can recreate it, otherwise I'll assume its something misconfigured in this workspace

tengstrand19:04:09

It only recognise resources to be a resources directory, all other directories are treated as source directories and validation 205 are checked for these. I think it's a good idea to also treat test-resources as a resource directory, so I created an https://github.com/polyfy/polylith/issues/305 for it.

🙌 4
kpav19:04:41

Thanks for the info and the issue @U1G0HH87L! I'll keep an eye on it 🙂

👍 2