+

Search Tips | Advanced Search

For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.


Integrating the MobileFirst Studio plug-in to manage a Cordova project in Eclipse

We can integrate the IBM MobileFirst™ Studio plug-in into your Eclipse development environment to run extra commands on your Cordova projects from an Eclipse menu.


Before you begin

Be sure that you have the following prerequisites before you start the procedure:

This procedure includes instructions for setting up the IBM MobileFirst Studio plug-in for Eclipse with or without The Eclipse Hybrid Mobile (THyM) version 2.0 plug-in integrated with your Eclipse environment. The THyM plug-in simplifies some of the management tasks of your Cordova projects in the Eclipse environment. These tasks include installing Cordova plug-ins directly from the Eclipse interface and creating Cordova projects directly in the Eclipse environment. The instructions apply to both situations, so follow the procedure that applies to your situation.

To integrate the IBM MobileFirst Studio plug-in into your Eclipse environment and manage a Cordova project in Eclipse, complete the following steps:


Procedure

  1. Install the IBM MobileFirst Studio Eclipse plug-in.

    1. Search for the IBM MobileFirst Studio Plug-in in the Eclipse marketplace.
    2. Select IBM MobileFirst Studio Plugins, and click Next.
    3. Accept the license terms and click Finish.
    4. Restart Eclipse.
  2. Optional: With the THyM plug-in: Install the THyM plug-in. The THyM plug-in is an optional open source plug-in that helps you manage your Cordova app in the Eclipse development environment. THyM is not required to use the IBM MobileFirst Studio plug-in, but it simplifies some of the Cordova project management within the Eclipse environment. IBM® does not support issues that result from the THyM plug-in. Steps that refer to the THyM plug-in are provided as a convenience.

    1. Open your Eclipse development environment and select Help > Eclipse Marketplace.
    2. Search for the plug-in for THyM 2.0, or later, and click Install.

      Restriction: Only THyM version 2.0, or later, is supported.

    3. Confirm that we want to install the THyM plug-in by ensuring that the check boxes for Eclipse Thym 2.0.0 and Hybrid Mobile Application Development Tools are selected. Click Confirm.
    4. Read and accept the license agreement; then, click Finish.
    5. Restart Eclipse.
  3. Create your Cordova project, if necessary. If you already have an existing project that you are importing, skip to step 4 if you are not using the THyM plug-in procedure, or to steps 5 or 6 if you are following the procedure with the THyM plug-in.
    • With the THyM plug-in:
      1. Select File > New > Other > Mobile > Hybrid Mobile (Cordova) Application Project, and click Next.
      2. Specify a name for our project, and click Next.
      3. Specify each platform, or engine, that your app uses, and click Finish. The platforms that are supported in IBM MobileFirst Platform Foundation are Android, iOS, and Windows Universal.

        Tip: Click Download... to retrieve any engines that are not available to select.

    • Without the THyM plug-in:
      1. In your terminal window, go to the directory where we want to create your Cordova app.
      2. Create your Cordova app by entering the following command:

          cordova create app_name app_identifier directory_for_app

        where the following are true:

          app_name
          The name of your app.
          app_identifier
          The unique identifier for our app.
          directory_for_app
          The directory where we want to create your app.

      3. In your terminal window, change to the root directory of your Cordova app.
      4. Add the platforms for our app by entering the following command:

          cordova platform add [ios | android | windows]

        Repeat this step for each platform that we want to add.

  4. Without the THyM plug-in only: Add the IBM MobileFirst Platform Foundation Cordova plug-in to our Cordova project.

    1. Go to the root directory of your Cordova project in the terminal window.
    2. Enter the following command to add the plug-in:

        cordova plugin add cordova-plugin-mfp

  5. Import your project into Eclipse, if necessary. If your existing Cordova project was created in Eclipse with the THyM plug-in installed, then you do not have to import it again.
    • With the THyM plug-in:
      1. Open the Eclipse development environment, and create a new project by selecting: File > Import > General > Import Cordova project, and click Next.
      2. Browse to the location of the project. Select it and click OK.
      3. Select the project and click Finish.
    • Without the THyM plug-in:
      1. Open the Eclipse development environment, and create a new project by selecting: File > New > Project > General > Project, and click Next.
      2. Enter a name for our project.
      3. Clear the check box for Default location.
      4. Browse to the root directory of your existing Cordova project.
      5. Select the Cordova project and click Finish.

        Note: If your Cordova project is in the same path as your Eclipse workspace, the Finish button is not active.

      Important: The IBM MobileFirst Platform Foundation Cordova plug-in must be installed in your Cordova project when you import it into Eclipse when you are not using the THyM plug-in. See step 4 for instructions about installing the IBM MobileFirst Cordova plug-in when you are not using the THyM plug-in.

  6. With the THyM plug-in only: Install the IBM MobileFirst Platform Foundation Cordova plug-in to our project in Eclipse.

    1. Right-click the name of your Cordova project in the Eclipse navigation.
    2. Select Install a Cordova Plug-in.
    3. Use the search string of "mfp" to find and install the cordova-plugin-mfp.
    4. Read and accept the license agreement; then, click Finish.
    5. Restart Eclipse.


Results

We can access the IBM MobileFirst Studio plug-in menu by right-clicking the name of your Cordova project in the Eclipse development environment. See Table 1 for the commands that are supported and their actions.

Parent topic: IBM MobileFirst Studio plug-in for managing Cordova projects in Eclipse