For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.
Create Java adapters
You create adapters either with Maven or with the MobileFirst Platform CLI.
Parent topic: Work with Java adapters
Create adapters with Maven
Before you begin
To work with Maven, ensure that you have it installed. For more information, see https://maven.apache.org/install.html.
Procedure
In the command line, cd to the location for the new Maven project, then type in the following command:
mvn archetype:generate -DarchetypeGroupId=com.ibm.mfp -DarchetypeArtifactId=adapter-maven-archetype-java -DarchetypeVersion=<latest_version> -DgroupId=<created_project_groupId> -DartifactId=<created_project_artifactId> -Dpackage=<created_project_java_package> -Dversion=<created_project_version> The following is an explanation of the parameters for the archetype:generate command:
- archetypeGroupId
- Archetype group ID. Identifies the MobileFirst adapter archetype template. Specify com.ibm.mfp in all cases.
- archetypeArtifactId
- Archetype artifact ID. Identifies the MobileFirst adapter archetype template. Specify adapter-maven-archetype-java.
- archetypeVersion
- Archetype version. Identifies the MobileFirst adapter archetype template. Specify the latest version that is available in the repository.
- groupId
- Sets the group of the new Maven project. Specify your own value. For more information, see What is the POM?.
- artifactId
- Sets the artifact ID of the new Maven project. This value will later be used as the adapter name. Specify your own value.
Note: The artifact ID can contain alphanumeric characters and underscores, and must start with a letter.
- package
- Sets the Java™ package name in src/main/java. Specify your own value. The default is <groupId>.
- version
- Sets the version of the new Maven project. Set your own value. The default is 1.0-SNAPSHOT.
Create adapters with MobileFirst Platform CLI
Before you begin
Ensure that you have installed MobileFirst Platform CLI and Maven.
Procedure
In the command prompt, run the following command:
mfpdev adapter create <adapter_name> -t <adapter_type> -p <adapter_package_name> -g <maven_project_groupid> The following is an explanation of the parameters for the mfpdev adapter create command:
- adapter_name
- Adapter name. Specify a value.
- adapter_type
- Adapter type. Specify Java.
- adapter_package_name
- Java adapter package name in src/main/java. Specify a value.
- maven_project_groupid
- Group ID of the Maven project.
Create adapters with the MobileFirst Operations Console
Procedure
We can also create an adapter in the MobileFirst Operations Console by clicking New in the Adapters area and following the instructions.