Search code examples
ddub

How to add and run subPackages in Dub?


Project/
  dub.sdl/
  source/
  examples/
    test/
      source/
        app.d
      dub.sdl

Project/dub.sdl

...
subpackage "./examples/test"
...

Project/examples/test/dub.sdl

name "test"
targetType "executeable"

If I try to execute dub run test if get the following error

Failed to parse package description for test in Project/examples/test.
Failed to find a package named 'test'.

The same happens if I try to execute dub run :test.


Solution

  • In the command, you should prefix the subpackage name with the root package name.

    dub run rootpackagename:test
    

    It appears you need to specify run (or build or some other command) explicitly).