Fork me on GitHub
#polylith
<
2023-08-11
>
timo09:08:04

I still have one problem since switching to polylith, one namespace (test-utils) is not loading, any idea on how to debug this? The repl just says Namespace not found. I am starting my repl like this: clj -M:dev:test:build:repl/portal and when I run clj -A:test:dev -Spath I can see it has the test-folder in there and poly ws out also shows the namespace... fortunately I can manually load the namespace and work with it but it's not convenient (and yes, its namespace is test-utils but the file has an underscore)

timo09:08:31

#error {
 :cause "Could not locate de/yobst/yobst_core/test_utils__init.class, de/yobst/yobst_core/test_utils.clj or de/yobst/yobst_core/test_utils.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name."
 :via
 [{:type java.io.FileNotFoundException
   :message "Could not locate de/yobst/yobst_core/test_utils__init.class, de/yobst/yobst_core/test_utils.clj or de/yobst/yobst_core/test_utils.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name."
   :at [clojure.lang.RT load "RT.java" 462]}]

timo09:08:31

another odd behaviour is that I can load the test-utils-ns once in the repl but the second time it tells me Namespace not found ...

tengstrand10:08:02

What IDE are you using?

timo10:08:31

no IDE, vim 🙂

👍 2
timo10:08:46

with conjure

timo11:08:31

tests are running fine, it's only in the repl

tengstrand11:08:45

I'm going on a trip today and will be quite busy this coming week, so hopefully someone in the community can help you with this, or @U2BDZ9JG3 if he has time.

timo11:08:30

ok, no problem. thanks anyway

tengstrand11:08:52

Good luck!

😆 2
furkan3ayraktar11:08:59

Which poly command is giving this error?

timo11:08:35

it's not the poly tool that gives the error. when I started a repl I get an error on loading my namespaces

timo11:08:18

it does not find the test-util namespace and I don't know how to get rid of this problem. as written above poly ws out shows the namespace is there and clj -A:test:dev -Spath also shows the classpath with the test-directory

tengstrand12:08:40

Maybe you can createa small repo where you reproduce the problem and share it here?

timo12:08:08

yeah, right. maybe I just try that

timo12:08:26

or renaming the file probably

timo11:08:10

just one more question that might be quick to answer. where would you put a logback.xml? I guess in the project, so one for development and one for production, right?

seancorfield15:08:44

projects/<name>/resources/logback.xml -- matches what we do with log4j2.properties for all our projects. And the dev/repl one goes in development/resources/ and make sure that in on your :dev > :extra-paths

👍 2
timo13:08:33

where would you put the test-resources? the logback or log4j2.properties for testing?

timo13:08:14

i assume they are going into the project right? with a test-alias and a test-resources directory, right?

seancorfield16:08:05

We use a JVM property during testing to specify a test-only log4j2.properties file, as I recall. But you could try something with a :test alias in projects/<name>/deps.edn for that -- I think you'd end up with both the production version and the test version on your path unless you use a test-specific name for the file?

seancorfield16:08:21

-Dlog4j2.configurationFile=/var/www/worldsingles/development/resources/log4j2-silent.properties -- since we know every env will always have that path (dev/test/CI/QA/production)

👍 2
Mateusz Mazurczak15:09:02

@U04V70XH6 and how do you use conditional rendering in .properties? Because you can use arbiters in xml, but this is not supported in .properties, so I'm wondering what's a good way to run something based on env there?

seancorfield20:09:39

We haven't found the need for that. An env var can specify which .properties file to use (and can be overridden by JVM opts) and that's been enough for us.

Mateusz Mazurczak22:09:27

And are you building whole .properties file from scratch, or are you using multiple files during run (e.g. with configurationFile)?

seancorfield22:09:55

I'm not sure what you're asking... we have three static properties files: one for dev, one for test, one for deployment.

seancorfield23:09:27

We originally wrote them "from scratch" I guess but they rarely change now. Occasionally we need to add a new library's config to set a default level.