Developing Adapters in Eclipse

As taught in previous Adapters tutorials, adapters are Maven projects that are created by using either Maven directly or via the PMF CLI. The adapter code can then be edited in any IDE, and later built and deployed using either Maven or the PMF CLI. A developer may also choose to create, develop, build and deploy all inside a supported IDEs, such as Eclipse or IntelliJ. In this tutorial an adapter is created and built from the Eclipse IDE.

Jump to

Prerequisites

  • First get familiarized with adapters by reading the Adapters tutorials.
  • Maven integration in Eclipse. Starting Eclipse Kepler (v4.3), Maven support is built-in in Eclipse.
    If your Eclipse instance does not support Maven, follow the instructions to add Maven support listed in the M2Eclipse.

Creating a new adapter Maven project

Follow the bellow instructions to either create a new adapter Maven project or import an existing one.

  1. To create a new adapter Maven project, select: File → New → Other… → Maven → Maven Project and click Next.
  2. Specify project name and location. Ensure that Create a simple project check box is not selected, and click Next.
  3. Select or add the adapter Archetype. Click on Add Archetype and provide the following details.

    Archetype Group Id: com.ibm.mfp

    Archetype Artifact Id: either adapter-maven-archetype-java, adapter-maven-archetype-http or adapter-maven-archetype-sql

    Archetype Version: You can find the latest available version in the Maven Central.

  4. Specify Group Id, Artifact Id, Version and package (Maven project) parameters, and click Finish.

Importing an existing adapter Maven project

Follow the bellow instructions to import an existing one.

  1. To import the adapter Maven project, select File → Import… → Maven → Existing Maven Projects.

Building and deploying an adapter Maven project

An adapter project can be built and deployed by using either Maven command-line commands, the PMF CLI or from Eclipse. For more information, see Build and Deploy Adapters.

Tip: Eclipse can also be enhanced to ease the deployment step by integrating a Command-line window using a plug-in, creating a consistent development environment. From this window Maven or PMF CLI commands can be run.

Building an adapter

To build an adapter, right-click on the adapter folder and select Run As → Maven install.

Deploying an adapter

To deploy an adapter, first add the deploy Maven command:

  1. Select Run → Run Configurations…, right-click on Maven Build and select New.
  2. Specify a Name: “Maven deploy”.
  3. Set as a Goal: “adapter:deploy”.
  4. Click Apply, and then clcik Run to have an initial deploy.

You can now right-click on the adapter folder and select Run As → Maven Deploy.

Building and deploying an adapter

You can also combine the “build” and “deploy” Maven Goals to a single “build and deploy” Goal: “clean install adapter:deploy”.

Further reading

Learn how to debug Java code in adapters in the Testing and debugging adapters tutorial.

Last modified on