How to build the Cordova HelloWorld ExampleProject

Purpose of this page

This page explains how the HelloWorld project provided on the Cordova homepage can be built with the xcode-maven-plugin.

The big picture

Within the HelloWorld example provided on the Cordova homepage the CordovaLib project is embedded as source code into the HelloWorld project. The xcode-maven-plugin uses the dependency resolution mechanism provided by maven. With this approach there is no need for including dependent project on the level of the source code. Instead the dependent projects are built in there own cycle and consumed afterwards without there source code based project. This means: first we build the CordovaLib using the xcode-maven-plugin. As the result of that step the headers and the compiles library representing the CordovaLib are exposed in a binary repository. After that we build the HelloWorld project. The HelloWorld project declares a depenency to the CordovaLib on the level of the maven project. Before the HelloWorld project is compiled the headers and the binary representing the CordovaLib are materialized into the HelloWorldProject. In order to get this working we need to adjust the header search path and the library search path accordingly.

How it works

Unzip the attached zip file in an arbitrary folder, cd into the bin directory and run ./all.sh ${CORODVA_VERSION} . CORDOVA_VERSION is the latest version of the cordova library.

If you are behind a firewall adjust the HTTP_PROXY in file bin/prepareCordova.sh.

This shell script

  • downloads the Cordova sources.
  • mavenizes the CordovaLib project (relocated the project sources to src/xcode, adds the pom file.).
  • builds the CordovaLib project with maven.
  • creates the HelloWorld project as described here
  • mavenizes the HelloWorld project. (Relocated the sources to src/xcode, adds the pom file. During this step the embedded CordovaLib project is removed).
  • Builds the HelloWorld project with maven.

After calling the script the

  • CordovaLib project is located inside ./projects/CordovaLib
  • HelloWorld project is located inside ./projects/HelloWorld

As always: the best documentation is the source code. Please review the shell scripts and the pom files that can be found inside the mavenized projects.