質問

How can I install Yaws as a Rebar dependency in my Erlang application?

Thanks,

LRP

役に立ちましたか?

解決

First, make sure you're using a recent version of rebar, say from April 2012 or later (rebar commit dc472b or later), as changes to it were made in early 2012 specifically to support projects like Yaws.

To use Yaws as a dependency, specify the following in your rebar.config file:

{deps, [{yaws, ".*", {git, "git://github.com/klacke/yaws", {branch, "master"}}}]}.

You can replace the {branch, "master"} part with a specific Yaws tag if you like:

{deps, [{yaws, ".*", {git, "git://github.com/klacke/yaws", {tag, "yaws-1.94"}}}]}.

Note, though, that I don't recommend using a version lower than Yaws 1.94 due to changes made to Yaws specifically for rebar build support.

How you actually run Yaws depends on how your app uses it. Using it in an embedded fashion is probably best for rebar-built apps, since that way you won't have any dependencies on yaws.conf files. But if you want to run Yaws as a stand-alone web server, you can build your dependencies and your application and then run Yaws interactively like this:

rebar get-deps compile
./deps/yaws/bin/yaws -i -pa ebin

This uses the default yaws.conf file found in ./deps/yaws/etc/yaws/yaws.conf, which you can modify as needed. Starting Yaws in this fashion won't include the ebin directories of any other of your application's rebar dependencies in the load path, but you can either add the necessary paths using additional -pa options to Yaws, or by specifying them in the yaws.conf file.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top