[英]'Task could not be found' for custom mix task
我有一個任務在lib / mix / tasks / thing.exs
代碼是:
defmodule Mix.Tasks.Thing do
use Mix.Task
def run(_) do
IO.puts "hello world"
end
end
當我運行mix thing
或mix Thing
我得到The task thing could not be found
或The task Thing could not be found
我已經嘗試過預先運行mix compile
,這沒有用。
我也嘗試將這個問題的代碼直接放到我的mix.exs中,如該問題所示。 我仍然無法執行任務。
需要編譯混合任務。 如果你從lib/mix/tasks/thing.exs
重命名為lib/mix/tasks/thing.ex
那么它應該可以工作。
您可以在以下網址閱讀有關腳本模式(.exs)的更多信息: http ://elixir-lang.org/getting-started/modules.html#scripted-mode
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.