xcode Xcodebuild 在 jenkins with cocoapods 中失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25689967/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcodebuild fails in jenkins with cocoapods
提问by Ignat
I am using the xcode plugin. I had looked around, but most of the "solutions" did not work.
我正在使用 xcode 插件。我环顾四周,但大多数“解决方案”都不起作用。
My main issue is that in the xcworkspace that is generated, there is no scheme for the project I am trying to build. The plugin does the command
我的主要问题是在生成的 xcworkspace 中,我尝试构建的项目没有方案。插件执行命令
$ /usr/bin/xcodebuild -list -workspace Project.xcworkspace
$ /usr/bin/xcodebuild -list -workspace Project.xcworkspace
and the output only shows the Pod's schemes, not the main project scheme.
并且输出只显示了 Pod 的方案,而不是主要的项目方案。
Information about workspace "Project":
Schemes:
Pods
Pods-AFNetworking
Pods-Bolts
Pods-Facebook-iOS-SDK
Information about workspace "Project":
Schemes:
Pods
Pods-AFNetworking
Pods-Bolts
Pods-Facebook-iOS-SDK
I have the cocoapods buildstep with pod install
我有 cocoapods buildstep pod install
I put this as the Xcode plugin configs: Target: Project, clean before build, Configuration: Debug, Xcode schema file: Project, Xcode workspace file: Project, Build output directory: ${WORKSPACE}/build.
我把它作为 Xcode 插件配置:目标:项目,构建前清理,配置:调试,Xcode 模式文件:项目,Xcode 工作区文件:项目,构建输出目录:${WORKSPACE}/build。
This is the error that gets printed out:
这是打印出来的错误:
Going to invoke xcodebuild:, scheme: Project, sdk: DEFAULT, workspace: Project, configuration: Debug, clean: YES, archive:NO, symRoot: DEFAULT, configurationBuildDir: /Users/ignat/.jenkins/workspace/Project/build, codeSignIdentity: DEFAULT
[Project] $ /usr/bin/xcodebuild -scheme Project -workspace Project.xcworkspace -configuration Debug clean build CONFIGURATION_BUILD_DIR=/Users/ignat/.jenkins/workspace/Project/build
Build settings from command line:
CONFIGURATION_BUILD_DIR = /Users/ignat/.jenkins/workspace/Project/build
xcodebuild: error: The workspace 'Project' does not contain a scheme named 'Project'.
FATAL: Build directory does not exist at /Users/ignat/.jenkins/workspace/Project/build. Potential configuration issue.
Build step 'Xcode' marked build as failure
Finished: FAILURE
回答by LodeRunner
As the output of xcodebuild -list
says, your workspace only has schemes for the Pods.
正如输出xcodebuild -list
所说,您的工作区只有 Pod 的方案。
If your Jenkins instance pulls your project from a repository, it's likely you don't share your Project
scheme to everyone.
如果您的 Jenkins 实例从存储库中提取您的项目,则您很可能不会将您的Project
方案分享给所有人。
To fix this, you will need to share your scheme for all users using the repo. In Xcode, click on the Scheme name to open the scheme menu (upper left corner), and choose "Manage Schemes..."
要解决此问题,您需要为所有使用 repo 的用户共享您的方案。在Xcode中,点击Scheme名称打开scheme菜单(左上角),选择“Manage Schemes...”
In the Manage Scheme dialog, make sure that the scheme you want to build with Jenkins is shared to all users by checking the "Shared" box on the right.
在“管理方案”对话框中,通过选中右侧的“共享”框,确保您要使用 Jenkins 构建的方案已共享给所有用户。
Your Project
scheme should be listed on Jenkins after that.
之后,您的Project
计划应该会在 Jenkins 上列出。