Fork me on GitHub
#polylith
<
2021-10-31
>
spacebat00:10:47

Hi, I've been following along with http://polylith.gitbook.io and ran into a snag - everything was OK until I got to the part where you run "poly" and get a shell. Turns out up to that point I'd been using poly 0.1.0-alpha9 and it expected a command. I realised that I needed to upgrade the poly jar file I was using and got the latest 0.2.13-alpha, however now no poly command works within my project directory, for example running poly help gives Error in ./worspace.edn: {:top-namespace ["missing required key"]}

spacebat00:10:09

I'm trying to figure out what key is missing but the error seems to give no indication - unless the missing key is :top-namespace? In which case I'm not sure what to put there.

spacebat00:10:35

this is my workspace.edn: { :projects {"development" {:alias "dev"} "command-line" {:alias "cli"}} }

spacebat00:10:41

OK I tried changing top-namespace to the common prefix of all my code in the project, as a string, now it complains about deps.edn missing from a component

spacebat00:10:11

I'm guessing it may be best to start again from the beginning but with the new version of the tool so it generates the things it expects to see

spacebat03:10:46

...and doing that I seem to be back on track

tengstrand05:10:35

If your workspace has been created with an old version of the poly tool, it has to be migrated, which is described https://polylith.gitbook.io/poly/install/leiningen. But if you are just playing around, it’s probably easier to just start all over as you just did!

spacebat08:10:22

Thanks, I did try poly migrate but that failed in the same way as every other poly command at the time, so I started from scratch. That got me further along, then as I got to the point of building an uberjar of the command-line project I got stuck again - turns out I needed to update to a recent pre-release of clojure, then I got stuck again on: $ clojure -X:build uberjar :project command-line Namespace could not be loaded: build

spacebat08:10:19

I thought perhaps I need to be in the projects/command-line directory when I run that, but that produces: Unqualified function can't be resolved: uberjar

spacebat09:10:27

the OK adding :extra-paths ["."] to the :build alias in the root directory got me further, but compilation fails with an error saying it can't locate the core file as a class, clj or cljc file

spacebat09:10:38

seems there's a lot of ways to get things wrong I'm just trying to get to the point I can produce a jar file that when called prints hello world

spacebat09:10:52

if I can get that working then I feel like I can iterate and start seeing the benefits of the architecture

tengstrand10:10:13

What do you get back if you execute clojure --version ?

spacebat13:10:31

Clojure CLI version 1.10.3.1013

spacebat13:10:05

I managed to print the classpath just before build.clj calls (bb/uber opts) and the bases/cli/src directory is there, so it's strange that whatever happens next doesn't find the core.clj which is definitely there

spacebat13:10:29

well I'd better sleep, thanks very much for looking at this

spacebat13:10:00

It's been a long time since I've been embroiled in classpath hell, I'll find a way out

tengstrand13:10:11

If you can share the project you have problems with somewhere, then I can have a look at it.

seancorfield18:11:20

If you could share the steps you used to create the project and, in particular, how you created build.clj, that might help us help you @U027P8D1P5H -- it's possible there are still bugs in the new docs around using build.clj with Polylith. That's all a fairly recent addition.