nathany

nathany

Duplicated modules error from running mix release

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.

Most Liked

sodapopcan

sodapopcan

I’m guessing your CI is not catching this since --warnings-as-errors doesn’t catch warnings coming from dependencies. I was having trouble finding documentation that spells this out but here is the PR.

I otherwise think that it’s good practice to keep mix tasks under some private namespace, just as we’re generally encouraged to namespace our apps, event though they don’t end up in the final release.

Where Next?

Popular in Questions Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
LegitStack
I’m hoping you guys can give me some general advice and perhaps code examples if you’re feeling up to it. I’m very interested in Elixir,...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
Codball
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Other popular topics Top

chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New

We're in Beta

About us Mission Statement