Using IntelliJ to Develop MobileFirst Java Adapters
Lior Burg April 14, 2016
MobileFirst_Platform Java IntelliJIn 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
-
Go to File → New → Project and select the Maven tab.
- 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:
com.ibm.mfp
- ArtifactId:
adapter-maven-archetype-java
- Version:
8.0.0
- GroupId:
- 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:
-
Make sure the
adapter-maven-archetype-java
is marked and click Next. -
Specify the required GroupId, ArtifactId and Version and click Next.
-
In the following page, click Next.
-
Provide project name and location and click Finish
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 Plugins → adapter and double click the adapter:deploy command.
Tip You can also build and deploy the adapter using a single command:
- Go to Run → Edit Configurations and click the + button to add new Maven configuration.
-
Provide a name, set the Command line value to
mvn install adapter:deploy
and click OK. - 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:
- Go to Run → Edit Configurations and click the + button to add new Remote configuration.
-
Provide a Name, set the Port value to “10777” and click OK.
- 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.