---
title: "WARNING: Global access to Rake DSL methods is deprecated.  Please include"
author: "suchj"
date: "2011-09-21T10:19:18Z"
tags: []
categories: ["编程语言"]
slug: "warning-global-access-to-rake-dsl-methods-is-deprecated-please-include"
draft: false
lastmod: "2011-09-21T10:22:19Z"
id: 1176821
url: "https://suchj.iteye.com/blog/1176821"
---

在运行rake脚本的时候，出现这样的警告：
WARNING: Global access to Rake DSL methods is deprecated.  Please include
    ...  Rake::DSL into classes and modules which use the Rake DSL methods.

WARNING: DSL method **DemoApp::Application**#task called at /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:214:in `initialize_tasks'

在Rakefile中的DemoApp::Application.load_tasks之前前再加上include Rake::DSL即可解决。