Xcode Maven Plugin

The Xcode Maven Plugin can be used in order to run Xcode builds embedded in a Maven lifecycle. Currently it supports these build types:

  • iOS Library Builds: If you specify xcode-lib as packaging type in the pom.xml a couple of goals will be added to your Maven lifecycle that take care of resolving dependencies, executing the Xcode build and uploading the build artifacts into your Maven repository. More...
  • iOS Framework Builds: If you specify xcode-framework as packaging type in the pom.xml a couple of goals will be added to your Maven lifecycle that take care of resolving dependencies, executing the Xcode build and uploading the build artifacts into your Maven repository. More...
  • iOS App Builds: This build is similar to library build, however, it also performs code signing that is necessary to upload the app to the AppStore. Apps are identified by a xcode-app packaging specification in your pom.xml. More...

If you are developing an app or a library in your Xcode environment there is no real need to run the Xcode build with Maven. Nevertheless, you can call mvn initialize in order to retrieve your library dependencies out of a central repository.

However, if your central software production processes are already based on Maven, this plugin enables you to build also your iOS libraries and apps with Maven and use a repository to distribute the binary build results.

Why Should I Use It?

This is a really good question to ask and the answer depends on your usage intention.

If you are developing iOS apps within Xcode and you are releasing them from the same computer you do the development on, then Xcode already provides all you need and you will never ever even think about adding the Maven complexity to your build system. Chances that you end up on this web site tend to zero. If you came across the site, nevertheless, than you might belong to the second group of people: The Maven Evangelists.

If you are a Maven evangelist, you love Maven and want to do everything with Maven, you will be thrilled to see that Maven now has even entered the Apple empire. Now it won't take long until Maven obtains world domination...

Finally, you might be working for a company that already has created a Maven infrastructure by having a central binary repository, a central build system, etc. Now you want to reuse this infrastructure to build your iOS libs and apps in order to gain one or more of the following benefits:

  • Binary Repository: You want to store all your build artifacts in a central binary repository so that you can access and reuse them at any point in time. All your lib and app releases are preserved in one location.
  • Dependency Management: Maven manages the binary dependencies for you. If your app depends on some other libs you can clearly define which version of the lib you are interested in and even the transitive dependencies will be correctly resolved. As Xcode does not offer a mechanism to manage binary dependencies this is a big advantage of using Maven in a modularized environment.
  • Minimal Overhead for Local Developers: In the local development environment Maven is only used to retrieve the binary dependencies from the repository. All you have to do is calling mvn initialize and afterwards you keep on working in your Xcode IDE.
  • Build System Injected Versioning: Your central build system can inject the version of your lib or app as we are using the resolve-pom-maven-plugin in the build lifecycle.
  • Central Build Configuration: You can override the provisioning profile, code sign identity and AppId through Maven settings. This allows for building your app with an enterprise account for internal distributions and test in parallel to building it for the App Store. You do not have to modify your Xcode project settings, but the xcode-maven-plugin will override the settings and adapt the AppId.

Prerequisites

The following prerequisites have to be fulfilled in order to use the Xcode Maven plugin:

  • Mac OS X >= 10.7 (Lion) The build has to run on a Mac computer.
  • JRE 6 The Java runtime environment has to be installed on the computer.
  • Maven >= 3.0.2 Maven 3 has to be installed and configured correctly so that is has access to central repositories.
  • Xcode >= 4.4 Xcode 4.4 or higher has to be installed as the plugin performs Xcode command line calls.

Goals Overview

The available goals are listed here: Goals.

However, normally you do not have to call any of these goals manually as they get attached to the Maven build lifecycle. Call mvn initialize to resolve the dependencies and make them available in your Xcode environment or mvn clean install to run the whole Xcode build with Maven.

Usage

General instructions on how to use the Xcode Plugin can be found on the usage page. Some more specific use cases are described in the examples given below.

Additionally a FAQ section exists.

User Guide

The "User Guide" section of the navigation bar on the left hand side contains a couple of interesting topics like

  • Consumption of Libraries
  • Consumption of Frameworks
  • A description of the build artifacts created by an App build or a Lib build

Examples

To provide you with better understanding of some usages of the Xcode Maven Plugin, you can take a look into the following examples:

  • Example of a Library build
  • Example of a Framework build
  • Example of an App build

Contributions

Contributions are welcome. In case you work with eclipse you are kindly asked to apply this formatting rules.