Reputation: 171
i'm trying to Archive my code by Jenkins and CocoaPods.
But build error, it seems the project can find the module generated by CocoaPods.
i use swift to code and the project is build successfully in Xcode
the podfile is like:
platform :ios, '8.0'
use_frameworks!
target 'MyProject' do
pod 'AFNetworking'
pod 'ObjectMapper'
end
the error log in Jenkins is:
....
/Users/xxx/.jenkins/jobs/LIFE_iOS/workspace/MyProject/Core/Model/ItemResult.swift:10:8: error: no such module 'ObjectMapper'
import ObjectMapper
^
** BUILD FAILED **
The following build commands failed:
CompileSwift normal arm64 /Users/xxx/.jenkins/jobs/LIFE_iOS/workspace/MyProject/MGFramework/CustomViews/MartyJunior/MJTableViewTopCell.swift
...
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(5 failures)
Build step 'Xcode' marked build as failure
Finished: FAILURE
Upvotes: 2
Views: 3846
Reputation: 525
Specify the workspace name in the Jenkins Project configuration. Follow Configure > build > Xcode > Advanced XCode build options -> XCode Workspace File. This enabled the jenkins to invoke the xcodebuild with workspace rather than project and that includes the pod dependencies. Make sure you have a build step of type execute shell "/usr/local/bin/pod install" prior to xcode build step.
Upvotes: 2
Reputation: 2359
As pointed out by @Santosh, opening the workspace is the right thing to do when using the Xcode UI.
As you are probably using xcodebuild
on the command line (or Jenkins is), instead of specifying a project and a target, you have to run xcodebuild
with a workspace and a scheme. Just wanted to add this, as you were asking for Jenkins.
So without CocoaPods, you could have done:
xcodebuild -project MyProject.xcodeproj -target MyTarget -configuration Release
Now, with CocoaPods, you have to:
xcodebuild -workspace MyProject.xcworkspace -scheme MyScheme -configuration
Upvotes: 7
Reputation: 2914
Once you are done with pod install
, you should open your .xcworkspace
and not .xcodeproj
. Please try it and let me know.
Upvotes: 0