Developer

Setting Up the iOS Development Environment That Uses Maven

Set up your development environment that uses a Maven repository.

Procedure

  1. Run the deploy.sh script and deploy the artifacts:
    1. After installing SAP Mobile Platform SDK, the deploy.sh script file appears under the iOS folder.
    2. Deploy the libraries to the local Maven repository of the application developer by opening a terminal and running deploy.sh with either:
      • $ ./deploy.sh - executing the script without an argument deploys all artifacts to the ~/.m2/repository default location.
      • $ ./deploy.sh ~/m2/localRepository - uses the parameter as the location of the local repository.
    3. After running the script, all artifacts are deployed into the local Maven repository under the com.sap.smp.client.ios group id.
  2. Use the deployed artifacts with the Maven infrastructure. When you create an Xcode project or use an existing one with Maven, you must create a pom.xml file and manually add it to the project:
    1. Add the following section to the dependency tag to import the Maven artifacts to the target folder of the project:
      • For the Odata libraries add:
        <dependency>
          <groupId>com.sap.smp.client.iosdemo</groupId>
          <artifactId>ODataSDK</artifactId>
          <version>3.X.X</version>
          <type>pom</type>
        </dependency>
        
      • For the MAF libraries add:
        <dependency>
          <groupId>com.sap.smp.client.iosdemo</groupId>
          <artifactId>MAFSDK</artifactId>
          <version>3.X.X</version>
          <type>pom</type>
        </dependency>
        
        <build>
             <plugins>
                 <plugin>
                     <groupId>com.sap.prd.mobile.ios.mios</groupId>
                     <artifactId>xcode-maven-plugin</artifactId>
                     <version>1.14.1</version>
                     <extensions>true</extensions>
                 </plugin>
              </plugins>
             </build>
        
    2. After the pom.xml is created, run mvn initialize.

      All artifacts are copied under the target folder after initialization.

    3. Open the project and open Build Settings. Search for the Library search path and Header search path settings.
      • Add $(PROJECT_DIR)/../../target/headers/$(BUILD_STYLE)-$(PLATFORM_NAME) to the header search path.
      • Add $(PROJECT_DIR)/../../target/libs/$(BUILD_STYLE)-$(PLATFORM_NAME) to the library search path.
  3. Open the Build Phases and open the Link Binary With Libraries and with e + icon, and add the necessary libraries to your project.