Local package precompilation issues in 1.9

I’d like to fully adopt Julia version 1.9 in my workflow, and also to recommend it to some new staff who are joining us at work soon, but I continue to have problems with local package development. (See my original issue here: https://discourse.julialang.org/t/local-package-precompilation-fails-for-julia-1-9-0/98802)

With the new staff I mentioned, it will be important that we can maintain some custom packages at a commonly accessible location on our server rather than in home directories. Most of the packages will be relevant to just us. Some of them depend on each other.

For that reason, in Julia 1.8 and prior versions my process was to have a pushfirst!(LOAD_PATH, my_local_pkg_dir) line in my ~/.julia/config/startup.jl file. But I haven’t been able to get this approach to work with 1.9 yet.

To start with the HelloWorld example, following the documentation at https://pkgdocs.julialang.org/v1/creating-packages/:

(@v1.9) pkg> generate HelloWorld
(@v1.9) pkg> activate HelloWorld
(@v1.9) pkg> add Random JSON

And then I exit the REPL, add lines for “using JSON” and “using Random” to the src/HelloWorld.jl file, and then come back to Julia …

julia> using HelloWorld
[ Info: Precompiling HelloWorld [e6edf740-f559-458d-b851-fb49f7c55ba6]
ERROR: LoadError: ArgumentError: Package JSON [682c06a0-de6a-54ab-a142-c8b1cf79cde6] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.

I’m able to get this to work if I dev the package and put it in ~/.julia/dev, but not if I put it anywhere else (even if I set a JULIA_PKG_DEVDIR environment variable). Even then however, there’s one additional thing I seem to be unable to do: make the package depend on one (or more) other locally developed packages. In 1.8 and previous versions, I used to do this by looking at the UUID of the local package I wanted to add and manually adding it to the Project.toml for the package that I want to use it in. This has stopped working in 1.9, however, and it doesn’t seem to want to support add either for anything that’s not part of a registry.

(@v1.9) pkg> generate HelloWorld2
(@v1.9) pkg> activate HelloWorld2
  Activating new project at `~/HelloWorld2`
(HelloWorld2) pkg> add HelloWorld
[ Info: Use `./HelloWorld` to add or develop the local directory at `~/HelloWorld`.
ERROR: The following package names could not be resolved:
 * HelloWorld (not found in project, manifest or registry)
   Suggestions: HelloWorldC_jll HelloWorldGo_jll HelloWorldCxx_jll HelloWorldFortran_jll

(HelloWorld2) pkg> add ./HelloWorld
ERROR: Did not find a git repository at `HelloWorld`, perhaps you meant `Pkg.develop`?