anchor.diff:              %% type. These any_dir modules are processed FIRST.
               {ok, AnyDirModules} = application:get_env(rebar, any_dir_modules),
   
  -            %% Get the list of plug-in modules from rebar.config. These modules are
  -            %% processed LAST.
  -            {ok, PluginModules} = plugin_modules(Config),
  -
  -            Modules = AnyDirModules ++ DirModules ++ PluginModules,
  +            Modules = AnyDirModules ++ DirModules,
   
               %% Give the modules a chance to tweak config and indicate if there
               %% are any other dirs that might need processing first.
               {UpdatedConfig, Dirs} = acc_modules(select_modules(Modules, preprocess, []),
                                                   preprocess, Config, ModuleSetFile, []),
               ?DEBUG("~s subdirs: ~p\n", [Dir, Dirs]),
  +
  +            %% Add ebin to path if this app has any plugins configured locally.
  +            prep_plugin_modules(UpdatedConfig),
  +
               [process_dir(D, UpdatedConfig, Commands) || D <- Dirs],
   
               %% Make sure the CWD is reset properly; processing subdirs may have caused it
  
positive.code:             ?DEBUG("Missing plugins: ~p\n", [Modules -- FoundModules]),
              ok
      end,
      {ok, FoundModules}.
  
  %%
  %% Return .app file if the current directory is an OTP app
  
negative.code:                     ok
              end,
  
              %% Get the list of plug-in modules from rebar.config. These modules are
              %% processed LAST and do not participate in preprocess.
              {ok, PluginModules} = plugin_modules(UpdatedConfig),
  
              %% Finally, process the current working directory
              ?DEBUG("Commands: ~p Modules: ~p Plugins: ~p\n", [Commands, Modules, PluginModules]),
              apply_commands(Commands, Modules ++ PluginModules, UpdatedConfig, ModuleSetFile),
  
              %% Once we're all done processing, reset the code path to whatever
              %% the parent initialized it to
  