jenkins找不到Microsoft.WebApplication.targets

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jenkins找不到Microsoft.WebApplication.targets相关的知识,希望对你有一定的参考价值。

参考技术A 未找到导入的项目。
请查看路径是否正确或相同路径存在相同的文件。看下电脑上有C:\\ProgramFilesx86\\MSBuild\\Microsoft\\VisualStudio\\v11。
0\\WebApplications\\Microsoft。WebApplication。targets命令行参数改为:/p:Configuration=Release,VisualStudioVersion=11。0尝试,运行命令修复重启即可。

Jenkins iOS fastlane 构建:找不到“捆绑程序”

【中文标题】Jenkins iOS fastlane 构建:找不到“捆绑程序”【英文标题】:Jekins iOS fastlane build: Could not find 'bundler' 【发布时间】:2018-08-06 07:15:49 【问题描述】:

我尝试将 Jenkins 与 fastlane 结合使用。执行构建的 mac 是 jenkins master 的奴隶。 master安装在windows 10系统上。

当尝试使用 Jenkins 构建 iOS 版本并使用 bundle installbundle exec fastlane beta 时,我总是收到错误消息:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': 找不到'bundler' (>= 0.a) 总共 253 个 gem(s) (Gem::LoadError)

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /Users/MY_USER/.rvm/gems/ruby-2.5.0/bin/bundle:25:in `<main>'
from /Users/MY_USER/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:in `eval'
from /Users/MY_USER/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:in `<main>'

当我在 mac 本身的终端中执行命令 bundle install 时,该命令按预期工作。

我的 Jenkins 命令如下所示:

export PATH="/usr/local/bin:$PATH"
export PATH="$HOME/.fastlane/bin:$PATH"
export PATH="$HOME/.rvm/bin:$PATH"
export PATH="$HOME/.rvm/bin/rvm:$PATH"
export PATH="$HOME/.rvm/gems/ruby-2.5.0:$PATH"
export PATH="$HOME/.rvm/gems/ruby-2.5.0/bin:$PATH"

bundle install
bundle exec fastlane beta

我还尝试了命令的完整路径:$HOME/.rvm/gems/ruby-2.5.0/bin/bundle install,但这会导致同样的错误。

如果我尝试在没有 bundle 命令的情况下运行 fastlane,那么同样的错误会发生在 Could not find 'fastlane' 上。所以我认为这与路径有关,詹金斯没有找到/获取正确文件夹的正确路径。但我不知道设置中的错误隐藏在哪里。

附加信息:

echo $PATH 返回:

/Users/MY_USER/.rvm/gems/ruby-2.5.0/bin:/Users/MY_USER/.rvm/gems/ruby-2.5.0@global/bin:/Users/MY_USER/.rvm/rubies/ruby-2.5.0/bin:/Users/MY_USER/.rvm/gems/ruby-2.5.0:/usr/local/bin:/Users/MY_USER/.fastlane/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/appfiff/Development/android-sdk-macosx 2/platform-tools:/Users/appfiff/Development/android-sdk-macosx 2/tools:/Users/MY_USER/.rvm/rubies/ruby-2.5.0/bin/u3d:/usr/local/git/bin:/Users/MY_USER/.rvm/bin:/Users/MY_USER/.rvm/rubies/ruby-2.5.0/bin/u3d

Jenkins 命令的完整输出是:

+ export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/:/Users/MY_USER/.rvm/bin
+ PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/:/Users/MY_USER/.rvm/bin
+ export PATH=/Users/MY_USER/.fastlane/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/:/Users/MY_USER/.rvm/bin
+ PATH=/Users/MY_USER/.fastlane/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/:/Users/MY_USER/.rvm/bin
+ export PATH=/Users/MY_USER/.rvm/bin:/Users/MY_USER/.fastlane/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/:/Users/MY_USER/.rvm/bin
+ PATH=/Users/MY_USER/.rvm/bin:/Users/MY_USER/.fastlane/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/:/Users/MY_USER/.rvm/bin
+ export PATH=/Users/MY_USER/.rvm/bin/rvm:/Users/MY_USER/.rvm/bin:/Users/MY_USER/.fastlane/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/:/Users/MY_USER/.rvm/bin
+ PATH=/Users/MY_USER/.rvm/bin/rvm:/Users/MY_USER/.rvm/bin:/Users/MY_USER/.fastlane/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/:/Users/MY_USER/.rvm/bin
+ export PATH=/Users/MY_USER/.rvm/gems/ruby-2.5.0:/Users/MY_USER/.rvm/bin/rvm:/Users/MY_USER/.rvm/bin:/Users/MY_USER/.fastlane/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/:/Users/MY_USER/.rvm/bin
+ PATH=/Users/MY_USER/.rvm/gems/ruby-2.5.0:/Users/MY_USER/.rvm/bin/rvm:/Users/MY_USER/.rvm/bin:/Users/MY_USER/.fastlane/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/:/Users/apppfiff/.rvm/bin
+ export PATH=/Users/MY_USER/.rvm/gems/ruby-2.5.0/bin:/Users/MY_USER/.rvm/gems/ruby-2.5.0:/Users/MY_USER/.rvm/bin/rvm:/Users/MY_USER/.rvm/bin:/Users/MY_USER/.fastlane/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/:/Users/MY_USER/.rvm/bin
+ PATH=/Users/MY_USER/.rvm/gems/ruby-2.5.0/bin:/Users/MY_USER/.rvm/gems/ruby-2.5.0:/Users/MY_USER/.rvm/bin/rvm:/Users/MY_USER/.rvm/bin:/Users/MY_USER/.fastlane/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/:/Users/MY_USER/.rvm/bin
+ /Users/MY_USER/.rvm/gems/ruby-2.5.0/bin/bundle install
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'bundler' (>= 0.a) among 253 total gem(s) (Gem::LoadError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
    from /Users/MY_USER/.rvm/gems/ruby-2.5.0/bin/bundle:25:in `<main>'
    from /Users/MY_USER/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:in `eval'
    from /Users/MY_USER/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:in `<main>'

.

$ which bundle
/Users/MY_USER/.rvm/gems/ruby-2.5.0/bin/bundle

$ which ruby
/Users/MY_USER/.rvm/rubies/ruby-2.5.0/bin/ruby

$ gem list bundler
*** LOCAL GEMS ***

bundler (1.16.3)
bundler-unload (1.0.2)
rubygems-bundler (1.4.4)

我的宝石文件:

source "https://rubygems.org"

gem "fastlane"

我的 Gemfile.lock:

GEM
  remote: https://rubygems.org/
  specs:
    CFPropertyList (3.0.0)
    addressable (2.5.2)
      public_suffix (>= 2.0.2, < 4.0)
    atomos (0.1.2)
    babosa (1.0.2)
    claide (1.0.2)
    colored (1.2)
    colored2 (3.1.2)
    commander-fastlane (4.4.6)
      highline (~> 1.7.2)
    declarative (0.0.10)
    declarative-option (0.1.0)
    domain_name (0.5.20180417)
      unf (>= 0.0.5, < 1.0.0)
    dotenv (2.5.0)
    emoji_regex (0.1.1)
    excon (0.62.0)
    faraday (0.15.2)
      multipart-post (>= 1.2, < 3)
    faraday-cookie_jar (0.0.6)
      faraday (>= 0.7.4)
      http-cookie (~> 1.0.0)
    faraday_middleware (0.12.2)
      faraday (>= 0.7.4, < 1.0)
    fastimage (2.1.3)
    fastlane (2.100.0)
      CFPropertyList (>= 2.3, < 4.0.0)
      addressable (>= 2.3, < 3.0.0)
      babosa (>= 1.0.2, < 2.0.0)
      bundler (>= 1.12.0, < 2.0.0)
      colored
      commander-fastlane (>= 4.4.6, < 5.0.0)
      dotenv (>= 2.1.1, < 3.0.0)
      emoji_regex (~> 0.1)
      excon (>= 0.45.0, < 1.0.0)
      faraday (~> 0.9)
      faraday-cookie_jar (~> 0.0.6)
      faraday_middleware (~> 0.9)
      fastimage (>= 2.1.0, < 3.0.0)
      gh_inspector (>= 1.1.2, < 2.0.0)
      google-api-client (>= 0.21.2, < 0.22.0)
      highline (>= 1.7.2, < 2.0.0)
      json (< 3.0.0)
      mini_magick (~> 4.5.1)
      multi_json
      multi_xml (~> 0.5)
      multipart-post (~> 2.0.0)
      plist (>= 3.1.0, < 4.0.0)
      public_suffix (~> 2.0.0)
      rubyzip (>= 1.2.1, < 2.0.0)
      security (= 0.1.3)
      simctl (~> 1.6.3)
      slack-notifier (>= 2.0.0, < 3.0.0)
      terminal-notifier (>= 1.6.2, < 2.0.0)
      terminal-table (>= 1.4.5, < 2.0.0)
      tty-screen (>= 0.6.3, < 1.0.0)
      tty-spinner (>= 0.8.0, < 1.0.0)
      word_wrap (~> 1.0.0)
      xcodeproj (>= 1.5.7, < 2.0.0)
      xcpretty (~> 0.2.8)
      xcpretty-travis-formatter (>= 0.0.3)
    gh_inspector (1.1.3)
    google-api-client (0.21.2)
      addressable (~> 2.5, >= 2.5.1)
      googleauth (>= 0.5, < 0.7.0)
      httpclient (>= 2.8.1, < 3.0)
      mime-types (~> 3.0)
      representable (~> 3.0)
      retriable (>= 2.0, < 4.0)
    googleauth (0.6.2)
      faraday (~> 0.12)
      jwt (>= 1.4, < 3.0)
      logging (~> 2.0)
      memoist (~> 0.12)
      multi_json (~> 1.11)
      os (~> 0.9)
      signet (~> 0.7)
    highline (1.7.10)
    http-cookie (1.0.3)
      domain_name (~> 0.5)
    httpclient (2.8.3)
    json (2.1.0)
    jwt (2.1.0)
    little-plugger (1.1.4)
    logging (2.2.2)
      little-plugger (~> 1.1)
      multi_json (~> 1.10)
    memoist (0.16.0)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_magick (4.5.1)
    multi_json (1.13.1)
    multi_xml (0.6.0)
    multipart-post (2.0.0)
    nanaimo (0.2.6)
    naturally (2.2.0)
    os (0.9.6)
    plist (3.4.0)
    public_suffix (2.0.5)
    representable (3.0.4)
      declarative (< 0.1.0)
      declarative-option (< 0.2.0)
      uber (< 0.2.0)
    retriable (3.1.2)
    rouge (2.0.7)
    rubyzip (1.2.1)
    security (0.1.3)
    signet (0.8.1)
      addressable (~> 2.3)
      faraday (~> 0.9)
      jwt (>= 1.5, < 3.0)
      multi_json (~> 1.10)
    simctl (1.6.5)
      CFPropertyList
      naturally
    slack-notifier (2.3.2)
    terminal-notifier (1.8.0)
    terminal-table (1.8.0)
      unicode-display_width (~> 1.1, >= 1.1.1)
    tty-cursor (0.6.0)
    tty-screen (0.6.5)
    tty-spinner (0.8.0)
      tty-cursor (>= 0.5.0)
    uber (0.1.0)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.7.5)
    unicode-display_width (1.4.0)
    word_wrap (1.0.0)
    xcodeproj (1.5.9)
      CFPropertyList (>= 2.3.3, < 4.0)
      atomos (~> 0.1.2)
      claide (>= 1.0.2, < 2.0)
      colored2 (~> 3.1)
      nanaimo (~> 0.2.5)
    xcpretty (0.2.8)
      rouge (~> 2.0.7)
    xcpretty-travis-formatter (1.0.0)
      xcpretty (~> 0.2, >= 0.0.7)

PLATFORMS
  ruby

DEPENDENCIES
  fastlane

BUNDLED WITH
   1.16.3

什么有效:

直接在slave mac的终端调用bundle installbundle exec fastlane beta Jenkins 中的其他构建步骤

我已经尝试过的:

重新安装ruby 有和没有sudo 重新安装bundler 有和没有sudo/usr/local/lib/ruby/gems 文件夹中设置权限。 (来自Could not find 'bundler' (>= 0) among 0 total gem(s) (Gem::LoadError)) 使用完整路径,而不仅仅是bundle install 的命令

我想知道的:

我的设置中的错误在哪里?我觉得这很简单。 我需要做什么,才能将 Jenkins 与 fastlane 一起使用。

【问题讨论】:

【参考方案1】:

尝试将源设置为 rvm,我有这样的设置:

export GEM_HOME=\$HOME/.rvm/gems/ruby-2.5.0
export GEM_PATH=\$HOME/.rvm/gems/ruby-2.5.0:\$HOME/.rvm/gems/ruby-2.5.0@global
LANG=en_US.UTF-8
source "\$HOME/.rvm/scripts/rvm"
bundle update && bundle install
bundle exec fastlane $cmd

看来您在 Jenkins JVM 中使用了错误的 ruby​​ 版本:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0...

您可能需要在调用bundle ... 之前使用rvm use 2.5.0 设置正确的版本

Jenkins 的主要问题是,它运行在与您的终端(通常是您的 Mac)不同的环境中,因为它运行的是 JVM。 对于此设置,您需要像我一样调用 setup,然后再调用 Bundler(或任何 ruby​​ gem)。

【讨论】:

非常感谢!这解决了这个错误。我必须在GEM_HOMEGEM_PATH 的开头和结尾添加一个"

以上是关于jenkins找不到Microsoft.WebApplication.targets的主要内容,如果未能解决你的问题,请参考以下文章

任务 ':app:mergeDebugResources' 的 Jenkins 执行失败,找不到文件

Jenkins 项目找不到包;构建项目目标失败

wedriverio jenkins - 找不到 npm 命令错误

在 git jenkins 中找不到存储库

Jenkins iOS fastlane 构建:找不到“捆绑程序”

Jenkins Subversion Multibranch 管道找不到管道