rebar3
rebar3 copied to clipboard
How to add custom plugins using rebar3?
Previously we could use custom plugins in rel/plugins
, but how to add custom plugins using rebar3?
Instead of fetching from git
or hexpm
, shall we use path
to specify the plugins?
{plugins, [{custom_plugins, {path, "rel/plugins"}}]}.
There are no supported ways of having local plugins in released code, but currently in the main branch, in an umbrella project, you can put a plugin in plugins/
and declare it as if it were in hex and it will work. We're hoping to cut a release soon.
There is and will not be a supported way to do this outside of umbrella applications.
https://github.com/jiahuili430/local-plugins
I am trying to store the todo
plugin source code in the plugins/
folder (main/test/test1 branches) and I am getting the following error.
$ ./rebar3 todo
===> Compiling todo
===> Errors loading plugin todo. Run rebar3 with DEBUG=1 set to see errors.
===> Command todo not found
Do I need to change anything in rebar.config
?
- TODO plugin: https://bitbucket.org/ferd/rebar3-todo-plugin/src/master/
-
rebar3
binary file is built from the main branch:./bootstrap
That project is not an umbrella project. Umbrella projects’ defining characteristic is that they can contain multiple top-level Erlang/OTP applications, usually within a top-level apps/ or lib/ directory. Each of these applications may contain its own rebar.config file. This format is applicable to only for releases with one or more top-level applications, and can't easily be used as a dependency.
I think it's an umbrella project. I used the rebar3 new umbrella
to generate it. Just change the folder name from apps
to src
, and also add {project_app_dirs, ["src/*"]}.
to the rebar.config
.
https://github.com/jiahuili430/local-plugins/tree/main/src there's a top-level src/ directory.
A proper umbrella project would have apps/<appname>/src
to store the Erlang source code.
Changed the folder name back to apps
and it works now, thank you!