This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-22
Channels
- # aleph (20)
- # announcements (4)
- # babashka (72)
- # beginners (64)
- # biff (5)
- # calva (146)
- # cider (5)
- # clj-kondo (18)
- # clj-together (3)
- # cljsrn (28)
- # clojure (95)
- # clojure-berlin (2)
- # clojure-europe (34)
- # clojure-nl (2)
- # clojure-norway (3)
- # clojure-uk (3)
- # community-development (7)
- # conjure (1)
- # cursive (2)
- # data-science (12)
- # datalevin (13)
- # datomic (17)
- # events (2)
- # figwheel-main (5)
- # fulcro (7)
- # helix (8)
- # hyperfiddle (52)
- # jobs (1)
- # malli (14)
- # off-topic (32)
- # polylith (24)
- # remote-jobs (7)
- # scittle (3)
- # shadow-cljs (14)
- # slack-help (3)
- # spacemacs (3)
- # vim (2)
- # xtdb (6)
I am trying out polylith architecture but getting Error 108 after adding my first two components. This is Error 108:
Error 108 - Components with an interface that is implemented by more than one
component are not allowed for the development project.
The solution is to remove the component from the development project
and define the paths for each component in separate profiles
(including test paths).
Can someone explain to me what the underlying problem is? I don't see a component's interface that is implemented by more than one component.I assume it is because one component has a dependency on the other component. Is this not possible?
@U4GEXTNGZ Perhaps you copied one component to another and didn't change the ns
?
The error refers to profiles and swappable component implementations. So you have two different folders under components
that both have the same <top-level>.<name>.interface
namespace.
Could you please show the specific error message. It should be something like:
Perhaps an old version of the poly
tool that had different wording?
It’s from the help command output: https://github.com/polyfy/polylith/blob/a02680e6b37825b55232d94d99ea304c3c4f6059/components/help/src/polylith/clj/core/help/check.clj#L46-L50
If the interface is e.g. user
then you can run this command to see which components that implement it: poly ws get:interfaces:user:implementing-components
.
mmh, I set up the whole directory from scratch and it's gone. must have been a typo or some error I made. now it's gone. Thanks again.
timo@Zokolette> poly info ~/projects/datahike-polyrepo
stable since: 73da28b
projects: 1 interfaces: 1
bases: 0 components: 3
project alias status dev
---------------------------- ---
development * dev s-- s--
interface brick dev
---------------------------- ---
- datahike-lib * s--
- datahike-server * s--
- datalog-parser * s--
Error 106: More than one component that implements the interface was found in the development project: datahike-lib, datahike-server, datalog-parser
Error 108: Components with an interface that is implemented by more than one component are not allowed for the development project. They should be added to development profiles instead: datahike-lib, datahike-server, datalog-parser
Warning 205: Non top namespace datahike was found in datahike-lib.
Warning 205: Non top namespace datahike-server was found in datahike-server.
Warning 205: Non top namespace datahike-server.resources was found in datahike-server.
Warning 205: Non top namespace datahike.backward-compatibility-test.src was found in datahike-lib.
Warning 205: Non top namespace datahike.db was found in datahike-lib.
Warning 205: Non top namespace datahike.experimental was found in datahike-lib.
Warning 205: Non top namespace datahike.impl was found in datahike-lib.
Warning 205: Non top namespace datahike.index was found in datahike-lib.
Warning 205: Non top namespace datahike.index.hitchhiker-tree was found in datahike-lib.
Warning 205: Non top namespace datahike.integration-test was found in datahike-lib.
Warning 205: Non top namespace datahike.middleware was found in datahike-lib.
Warning 205: Non top namespace datahike.test was found in datahike-lib.
Warning 205: Non top namespace datahike.test.attribute-refs was found in datahike-lib.
Warning 205: Non top namespace datahike.test.middleware was found in datahike-lib.
Warning 205: Non top namespace datalog was found in datalog-parser.
Warning 205: Non top namespace datalog.parser was found in datalog-parser.
Warning 205: Non top namespace datalog.parser.impl was found in datalog-parser.
Warning 205: Non top namespace datalog.parser.test was found in datalog-parser.
Warning 205: Non top namespace deps.cljs was found in datahike-lib.
Warning 205: Non top namespace js was found in datahike-lib.
That's where I am right now: https://github.com/TimoKramer/datahike-polyrepo/commit/ffad98d0a9a77319a5b6b8fbf166f2f1d96ef369
The top namespace is set to io.replikativ (the key :top-namespace
in workspace.edn). If you look in e.g. components/datahike-lib/src
the poly tool is therefore expecting a top namespace/directory io
and a replikativ
directory inside it. Now the top namespace is datahike
and that's the reason the tool complains. You need either change the top namespace to "datahike" in workspace.edn or make sure all components use the top namespace io.replikativ
.
A component should follow this namespace convention: top-ns.interface-name. So if you have a component datahike-lib
and you want it to implement an interface with the name datahike-lib
then then a namespace x
in that component should live in the namespace io.replikativ.datahike-lib.x
and the directory structure under components/datahike-lib/src
and components/datahike-lib/test
should therefore be io/replikativ/datahike_lib/x
for the x
namespace.
Alright, I knew that. The Warning 205 is explained pretty straightforward in commands.md
. The Errors were throwing me off, they are just not clear to me. But you're saying they are disappearing once I rename my namespaces?
Yes, every component has to live in the top namespace.
@U1G0HH87L If the error is component does not have the correct top-namespace, the tool should not throw Error 106 and 108. It should only throw the Error 205. Also, in the output shared above, the poly tool states that there are components without an interface (indicated by a dash under the interface column). Since components can’t exists without an interface, instead of giving a wrong information, the tool should understand there is something wrong (in this case the top-namespace is not used properly) and report that instead. In the scenario above, a more meaningful error and output would be:
stable since: 73da28b
projects: 1 interfaces: 0
bases: 0 components: 0
project alias status dev
---------------------------- ---
development * dev s-- s--
interface brick dev
---------------------------- ---
Error XXX: Invalid component. Top namespace is not used in component datahike-lib
Error XXX: Invalid component. Top namespace is not used in component datahike-server
Error XXX: Invalid component. Top namespace is not used in component datalog-parser
Yes, that makes sense. I added a comment to https://github.com/polyfy/polylith/issues/277.
I have fixed the https://github.com/polyfy/polylith/issues/277 and merged it to master. It seems to work for your datahike-polyrepo repository, but you can have a look also @U4GEXTNGZ.