Building a Static Xcode Framework

If you configure your Xcode project to build an Xcode framework (see https://github.com/kstenerud/iOS-Universal-Framework) it is possible to execute this build from the Xcode Maven Plugin and upload the build results to the binary repository. All you have to do is setting the packaging type to xcode-framework as shown in the example below.

Calling mvn clean install will resolve the dependencies, compile the Xcode code, verify and package the resulting Xcode framework and upload it into the local repository. Make sure that your plugin configuration contains the line <extensions>true</extensions> which is needed to enable the Maven lifecycle modification.

Your framework must expose a fat library (i.e. for device and simulator both). We will check if your framework contains the simulator architecture and will let the build fail if not - otherwise the using applications will not be able to run on simulator during development and test phase. For successful build, you have to configure your Xcode project accordingly - set the Build Active Architectures Only Build Setting to No.

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                      http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>my.package</groupId>
  <artifactId>MyFramework</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>xcode-framework</packaging>

  <dependencies>
    <dependency>
      <groupId>my.package</groupId>
      <artifactId>BaseLibrary</artifactId>
      <version>1.0</version>
      <type>xcode-lib</type>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>com.sap.prd.mobile.ios.mios</groupId>
        <artifactId>xcode-maven-plugin</artifactId>
        <version>1.14.5</version>
        <extensions>true</extensions>
        <!-- optional configurations, e.g.
          <configuration>
             <!-- Earlier versions of the xcode-maven-plugin created only one
                  framework. The configuration for that the framework should
                  be built was specified with property below. For backward
                  compatibility the corresponding artifact is still deployed and
                  it is still possible to provide the configuration below.
                  Since version 1.9.3 the frameworks are created by default for the
                  configurations "Debug" and "Release". In case frameworks should be built
                  for other configurations these configurations needs to be specified
                  by the configurations sections mentioned below.
               -->
              <primaryFmwkConfiguration>Release</primaryFmwkConfiguration>
              
              
             <!-- Note that the framework project will be built by default
             for both Release and Debug configurations. If you want not to built
             for both, you should specify the desired configuration here -->
              
             <configurations>
               <configuration>Debug</configuration> 
               <configuration>Release</configuration>
             </configurations>
           <configuration>
          -->
      </plugin>
    </plugins>
  </build>
</project>