Using IntelliJ to Develop MobileFirst Java Adapters

In MobileFirst Platform Foundation 8.0 adapters are Maven projects. This means that you can easily create, develop, build, deploy and debug adapters, like any other Maven project, using supported IDEs such as Eclipse or IntelliJ.

This post demonstrates how to use IntelliJ to develop MobileFirst Java adapters. For instructions how to use Eclipse see the Developing Adapters in Eclipse tutorial.

Creating a New Java Adapter Maven Project

  1. Go to File → New → Project and select the Maven tab.

    New Maven project screen

  2. Select or add the MobileFirst adapter Archetype.
    • If you installed the archetypes locally and they are not appearing in the list of archetypes, tick the Create from archetype checkbox, click the Add Archetype button and provide the following details:
      • GroupId:
      • ArtifactId: adapter-maven-archetype-java
      • Version: 8.0.0

    Add archetype screen

  3. Make sure the adapter-maven-archetype-java is marked and click Next.

  4. Specify the required GroupId, ArtifactId and Version and click Next.

    Required parameters screen

  5. In the following page, click Next.

  6. Provide project name and location and click Finish

    Name and location screen

You are now ready to implement your Java adapter. To learn more about adapters visit the Adapters Category.

Building and Deploying a Java Adapter Maven Project

To quickly build and deploy your adapter use the Maven Projects view to run commands.
Go to View → Tool Windows → Maven Projects:

  • Build - Click on Lifecycle and double click the install command.
  • Deploy - Click on Pluginsadapter and double click the adapter:deploy command.

Tip You can also build and deploy the adapter using a single command:

  1. Go to Run → Edit Configurations and click the + button to add new Maven configuration.
  2. Provide a name, set the Command line value to mvn install adapter:deploy and click OK.

    Add run configuration screen

  3. You can then find the configuration in the Maven Projects view under Run Configurations.

Debugging a Java Adapter Maven Project

In order to debug adapter’s Java code, follow this instructions:

  1. Go to Run → Edit Configurations and click the + button to add new Remote configuration.
  2. Provide a Name, set the Port value to “10777” and click OK.

    Add new remote screen

  3. Click on Run → Debug YOUR-REMOTE-NAME to enter debug mode. You can now debug the Java code normally as you would do in a standard Java application. You need to issue a request to the adapter to make the code run and hit any set breakpoints.
Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.
Last modified on April 14, 2016