Why am I getting errors with git but not with hex deps in rebar3

247 Views Asked by At

I've come across this issue several times when using dependencies in my Erlang projects, such as

{rabbit_common, "3.7.8"}

vs

{rabbit_common, ".*", {git, "https://github.com/rabbitmq/rabbitmq-common.git", {tag, "v3.7.8"}}

When using git I had to go into each dependency app in lib folder and run make on it while with hex everything just worked.

Also, when docker-izing my app I found that I got an error

no release found

when using any git deps, but when I switched all to hex it worked fine. Is git dead for rebar3?

2

There are 2 best solutions below

0
On

Is git dead for rebar3?

No. It still works and I expect support for it to continue.

1
On

By default, rabbit_common in its github repository only supports erlang.mk as a build tool, and does not contain the data rebar3 would require (in rebar.config) to build it successfully.

Rebar3 is able to go in and try to compile an application that looks like it respects OTP, but in this case, particularly because deps are missing, rebar3 won't be able to know that some components are not in place.

However, much like Mix and Rebar3, erlang.mk can publish to hex. In doing so, some additional metadata is added to the lib, including dependencies. Other info is still not added (such as compiler options). Overall though, since the library is on hex, and apparently well-formed, rebar3 is able to build it along with its dependencies fine, but only once on hex.

Rebar3 support for git is expected to keep going for the foreseeable future. The current release candidate also adds support for many mix dependencies (along with https://github.com/tsloughter/rebar_mix as a plugin), but we currently have no open plans to support erlang.mk projects natively. Hex and some luck are your best options for this at this point in time.