1. 程式人生 > 其它 >[DEPRECATED] Your Gemfile contains multiple primary sources.

[DEPRECATED] Your Gemfile contains multiple primary sources.

技術標籤:railsGemfile

某次在執行bundler install時,提示警告資訊:

[DEPRECATED] Your Gemfile contains multiple primary sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. To upgrade this warning to an error, run `bundle config set --local disable_multisource true`.

看原因應該是有兩個source源,搜尋了一下專案,果然有兩個源,一個在根目錄/Gemfile,一個在plugin/redmine_messager/Gemfile,這兩個Gemfile在執行bundler時會合併到同一個Gemfile.lock中。

解決方法:

修改plugin/redmine_messager/Gemfile

source 'https://gems.ruby-china.com/'

gem 'slim-rails'
gem 'validate_url'

source 'https://gems.ruby-china.com/' do
  gem 'slim-rails'
  gem 'validate_url'
end

再次執行bundler,沒有報錯了

參考:https://stackoverflow.com/a/35314040/13497698