0

我可以让将使用我的 gem 的项目选择运行时依赖项的版本吗?

例如在我的 gem 的 gemspec 中:

Gem::Specification.new do |s|
  s.name = "my-gem"
  [...]
  s.add_runtime_dependency 'my-other-gem'
end

在我的主要项目的 Gemfile 中:

gem "my-gem"
gem "my-other-gem", "0.2.1"

如果我bundle install使用该配置从我的主项目执行 a ,则会出现以下错误:

Bundler could not find compatible versions for gem "my-other-gem":
  In snapshot (Gemfile.lock):
    my-other-gem (= 0.2.1)

  In Gemfile:
    my-other-gem (= 0.2.1)

    my-gem was resolved to 0.0.1, which depends on
      my-other-gem

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
4

0 回答 0