This error was a surprise from our Docker build. We have two different API client libraries that both have a mix task with the same module name (e.g.
mix token to generate an access token for testing).
#34 [builder 19/19] RUN mix release myapp #34 2.309 ** (Mix) Duplicated modules: #34 2.309 'Elixir.Mix.Tasks.Token' specified in library1 and library2 #34 ERROR: process "/bin/sh -c mix release myapp" did not complete successfully: exit code: 1
On the one hand, it seems like we should be able to avoid this entirely, since Mix doesn’t run in production, so there’s little point in copying these over into the release. But of course we need Mix to run
mix release so I’m not sure the best way to do that.
On the other hand, it’s a little strange to me that this is an error at release time, but the compiler doesn’t mind, so we didn’t catch it earlier in our CI process. That would’ve been nice.
It looks like these mix tasks are available from the main app in development (well, one of them), so it does make sense for me to rename one or put them down in a module named after the library. That further suggests that this issue should at least be a warning from
mix compile --warnings-as-errors.