In some projects that don't invoke the entire rails stack, adding rdoc to the Gemfile was the key to success for me:
group :development, :test do
gem 'rake', '~> 0.9.2.2'
gem "rdoc", '~> 3.12'
end
UPDATE: This was still bugging me with a rails 3.0.x project. Rakefile, gems all seemed ok but I was still getting the issue. To find out exactly where the warning wacoming from I put a canary in gems/rake-0.9.2.2/lib/rake/rdoctask.rb:
if Rake.application
begin
raise 'where am i'
rescue
puts $@
end
Rake.application.deprecate('require \'rake/rdoctask\'', 'require \'rdoc/task\' (in RDoc 2.4.2+)', __FILE__)
end
This immediately pointed to the issue in the rails stack itself. A quick check and it is apparent that rails 3.0.8 is full of requires to rake/rdoctask. Updating to rails (3.0.9 or higher I believe) fixes the issue (or you can downgrade rake as others have suggested).
But while you are stuck on ~ 3.0.8 and don't want to downgrade rake, you can suppress the warning by setting ignore_deprecate in your Rakefile:
require File.expand_path('../config/application', __FILE__)
require 'rake'
require 'rake/testtask'
require 'rdoc/task'
# add this (and perhaps make it conditional on Rails.version if you like):
Rake.application.options.ignore_deprecate = true
Babylon::Application.load_tasks
Why suppress the warning? My main motivation was to ensure cron jobs that invoke rake don't log and email spurious output.