Build and deploy in MobileFirst Studio
After creating the IBM MobileFirst project, we build the application and deploy it to MobileFirst Server to run and test it.
In Develop hybrid and web applications and Develop native applications, we learned the basics of creating and working with the projects in MobileFirst Studio. Here is an overview of the process for building these projects, deploying them to an instance of MobileFirst Server, and running them.
During development, to build and deploy the application, you right-click the application or an environment in the Project Explorer view of MobileFirst Studio, select Run As from the menu, and then select one of its options.
Building a MobileFirst application transforms the JavaScript, HTML, and CSS code into a mobile application for the specified environment, such as iOS or Android. The build process produces several elements:
- A native project for the target platform stored in the native folder of the environment.
- A MobileFirst application file (.wlapp) containing application metadata and web resources from which MobileFirst Server identifies and services the mobile application.
For more information about the iOS, Android, BlackBerry, and Windows Phone development environments, see Get Started page.
The generated native project depends on the target environment:
- iPhone and iPad
- The build process creates a native Xcode project, placed under the native folder of the environment. Then use Xcode to build the final iOS application. If we are working in MobileFirst Studio on a Mac computer, we can also right-click the iphone or ipad environment and use the Run As > Xcode project option to build the environment and open Xcode for that project.
- Android
- The native folder under the android folder contains automatically generated Android application code that is imported into the Eclipse workspace as an Android project. We use the ADT plug-in (Android Development Tools for Eclipse) to build the final Android application. If we are working in MobileFirst Studio on a computer with ADT installed, we can also right-click the android environment and use the Run As > Android Studio project option to open that project.
- BlackBerry
- The native folder contains BlackBerry code we can compile using the Ripple development environment.
- Windows Phone
- The native folder contains a Visual Studio project that you compile to build the final Windows Phone application.
The resulting files are stored in the MobileFirst Studio project hierarchy in...
project_name\bin
...with the following naming conventions:
project_name.war WAR file for the project. project_name-app.all.wlapp WLAPP file containing all environments for the project. project_name-app-common.wlapp WLAPP file containing all common resources for the project. project_name-app.environment_name.wlapp WLAPP file for each environment in the project. For example: MyProject-app-android.wlapp
Only the latest build is contained in the project_name\bin directory at any time. If we create multiple builds for different target servers for deployment using the operations console, the supplied Ant tasks, or the Server Configuration Tool, deploy them after each build operation because the next build overwrites the existing files.
We can modify the generated native projects if, for example, to add native code or Cordova plug-ins to the application. If we modify the HTML, JavaScript, CSS, the application descriptor file, or any application resources, rebuild the environment using the appropriate "Run As > Build" command to update the MobileFirst application file (.wlapp) and the native project.
After the build of the application completes, it is deployed or not deployed depending on which Run As command we used:
- The option...
Run As | Run on MobileFirst Development Server
...deploys the application metadata and web resources (the .wlapp file) to the internal MobileFirst Development Server. If we have defined an alternative test server using the Run As > Build Settings and Deploy Target option, we can also deploy directly to that instance of MobileFirst Server. In this case, the command name changes to include the name of the target server. For example, if we add a local instance of MobileFirst Server, name it Group Test Server and designate it as the default test server, this command appears in the menus as...
Run As | Run on Group Test Server
- The option...
Run As | Build
...builds the application or environment but does not deploy it. To deploy, we use the operations console, the supplied Ant scripts, or the Server Configuration Tool. For information about deploying MobileFirst apps to remote servers, see Deploy MobileFirst projects.
- The Run on MobileFirst Development Server command
- The Build All Environments command
- The Preview command
- The Build Settings and Deploy Target command
- Additional Run As menu options
Parent topic: Develop MobileFirst applications