# "can not merge projects" error when \`dev\`ing sister package from test project

**URL:** <https://discourse.julialang.org/t/can-not-merge-projects-error-when-dev-ing-sister-package-from-test-project/115575>\
**Category:** Package Management\
**Created:** [June 12, 2024, 8:50pm UTC](https://discourse.julialang.org/t/can-not-merge-projects-error-when-dev-ing-sister-package-from-test-project/115575 "2024-06-12T20:50:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxkapur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxkapur/32/21208_2.png) [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Post date:** [June 12, 2024, 8:50pm UTC](https://discourse.julialang.org/t/can-not-merge-projects-error-when-dev-ing-sister-package-from-test-project/115575/1 "2024-06-12T20:50:40Z")

</div>

I have run into an issue in trying to apply a project structure I have seen in some successful projects. Similar to StaticArrays.jl and StaticArraysCore.jl, I have `MyProject.jl` and `MyProjectCore.jl`, each with their own Git repository and `Project.toml`. So, picture the following directory structure on the local workstation (irrelevant files omitted):

```plaintext
git_repos
├── MyProjectCore.jl
│ ├── Project.toml
│ └── README.md
└── MyProject.jl
    ├── Project.toml
    ├── README.md
    └── test
        └── runtests.jl

```

(It is fairly easy to mock this up using PkgTemplates.jl but hard to show the interactive input in this forum post.)

`MyProject.jl` has `MyProjectCore.jl` as a dev dependency (`julia --project` in `MyProject.jl/`, then in REPL `]dev ../MyProjectCore.jl`.

This works just fine, but as I continued to build out `MyProject.jl`, I realized I wanted to add (for example) DataFrames.jl as a test dependency. That is, DataFrames.jl is needed to run the _tests_ for `MyProject.jl`, but is not needed for `MyProject.jl` itself, nor for `MyProjectCore.jl`.

So, I created `MyProject.jl/test/Project.toml` by running `julia --project` in `MyProject.jl/`, then in the REPL `]activate test` followed by `]add DataFrames`. No problems so far.

But now, I realized that I want to access some of the methods from `MyProjectCore.jl` directly in the `MyProject.jl` tests. Before, when I didn’t have a `MyProject.jl/test/Project.toml`, this was easy, because I was already `dev`ing `MyProjectCore.jl`. Now, I need to add `MyProjectCore.jl` as a dev dependency of the `test` projects, so again, from `MyProject.jl/` I run `]activate test` and `dev ../MyProjectCore.jl`.

This is where the trouble begins: If I now reactivate the `MyProject.jl` project (`]activate .`) and attempt to `]test` it, I get the infamous

```julia-repl
ERROR: can not merge projects

```

error.

Is there a way to make this project and dependency structure work?

---

<div class="post-metadata">

**Author:** ![maxkapur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxkapur/32/21208_2.png) [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Post date:** [June 16, 2024, 10:23pm UTC](https://discourse.julialang.org/t/can-not-merge-projects-error-when-dev-ing-sister-package-from-test-project/115575/2 "2024-06-16T22:23:49Z")

</div>

Is this worth filing a bug for, or is my workflow misguided? If the former, I can put together a sample github repo for reproducibility.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/224680_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [June 17, 2024, 5:11am UTC](https://discourse.julialang.org/t/can-not-merge-projects-error-when-dev-ing-sister-package-from-test-project/115575/3 "2024-06-17T05:11:18Z")

</div>

This is a well-known error, which often pops up when you have non-standard test workflows, see ["cannot merge projects" error · Issue #1585 · JuliaLang/Pkg.jl · GitHub](https://github.com/JuliaLang/Pkg.jl/issues/1585)  
Usually one solution is to avoid `test/Project.toml` and put everything in the main `Project.toml` file using the `[extras]` and `[targets]` fields

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [June 17, 2024, 5:42am UTC](https://discourse.julialang.org/t/can-not-merge-projects-error-when-dev-ing-sister-package-from-test-project/115575/4 "2024-06-17T05:42:14Z")

</div>

Which version are you getting the error on? In general, I don’t think you need to ` ]dev` the package under test in your tests. I use a `test/Project.toml`-based workflow and I never ` ]dev` the main package in there.

---

<div class="post-metadata">

**Author:** ![maxkapur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxkapur/32/21208_2.png) [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Post date:** [June 17, 2024, 12:09pm UTC](https://discourse.julialang.org/t/can-not-merge-projects-error-when-dev-ing-sister-package-from-test-project/115575/5 "2024-06-17T12:09:38Z")

</div>

Thanks! I saw that issue and initially thought it didn’t apply because of this explanation:

> Yeah that is a pretty bad error message. It happens when the active manifest and the test manifest both have fixed nodes that disagree (for example the active manifest and the test manifest both are tracking the same UUID by path but are tracking it a different paths). Pkg has to preserve fixed nodes but it doesn’t know which one to keep.

I get the error even when I `]dev` with absolute paths, so this seems not to be the full story. But the suggested workaround of `using MyProject.MyProjectCore` in the tests of the former worked for me, so I appreciate the link.

@Sukera v1.10.4. Note that I am not trying to `]dev` the package being tested (MyProject.jl) but rather a sibling project (MyProjectCore.jl) that MyProject.jl depends on. To use a well-known example, this would be like using methods from StaticArraysCore.jl in the tests for StaticArrays.jl on a workstation where you are developing both packages.

---

<div class="post-metadata">

**Author:** ![lwhitefox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lwhitefox/32/4363_2.png) [@lwhitefox](https://discourse.julialang.org/u/lwhitefox)\
**Post date:** [December 24, 2024, 8:37pm UTC](https://discourse.julialang.org/t/can-not-merge-projects-error-when-dev-ing-sister-package-from-test-project/115575/6 "2024-12-24T20:37:27Z")

</div>

@maxkapur - can you add a little detail on what you mean by using `MyProject.MyProjectCore` in tests?

I’m having the same issue with “sibling projects”; I followed the link for issue #1585 but can’t track what you refer to. Thanks!

---

<div class="post-metadata">

**Author:** ![maxkapur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxkapur/32/21208_2.png) [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Post date:** [December 24, 2024, 11:52pm UTC](https://discourse.julialang.org/t/can-not-merge-projects-error-when-dev-ing-sister-package-from-test-project/115575/7 "2024-12-24T23:52:00Z")

</div>

If memory serves, the precise comment in the GitHub issue that got me to the solution was this one:

[https://github.com/JuliaLang/Pkg.jl/issues/1585#issuecomment-1092256497](https://github.com/JuliaLang/Pkg.jl/issues/1585#issuecomment-1092256497)

Unfortunately, I don’t remember the exact details or have the code in front of me (this was a work project that we ended up having to port to Python/NumPy).

---

<div class="post-metadata">

**Author:** ![lwhitefox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lwhitefox/32/4363_2.png) [@lwhitefox](https://discourse.julialang.org/u/lwhitefox)\
**Post date:** [December 25, 2024, 2:57pm UTC](https://discourse.julialang.org/t/can-not-merge-projects-error-when-dev-ing-sister-package-from-test-project/115575/8 "2024-12-25T14:57:37Z")

</div>

Thank you for the reply!
