繁体   English   中英

自定义混合任务无法找到“任务”

[英]'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 thingmix Thing我得到The task thing could not be foundThe 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM