Importing an existing Maven project into Eclipse

§Importing an existing Maven project into Eclipse

If you have a Maven project created from an archetype (as described in Creating and running Hello World with Maven) or one you created on your own, import it into Eclipse as follows:

§Check prerequisites

Before attempting to create a Lagom Maven project in Eclipse, ensure that Eclipse is configured with the following:

  • An m2eclipse plugin compatible with Maven 3.3 or higher.
  • A JDK 1.8

§Import the project

  1. From the File menu, select Import.
    The Select screen opens.
  2. Expand Maven and select Existing Maven Projects.
  3. Click Next.
  4. For Root Directory, click Browse and select the top-level project folder.
  5. Verify that the Projects list includes all subprojects and click Finish.
  6. Run the project:
    1. Right-click the parent project folder.
      Eclipse puts all of the Maven project folders at the same level, so be sure to select the correct one. For example, if you used my-first-system as the Maven artifact ID, right-click my-first-system.
    2. Optionally, change the name.
    3. Select Run as … > Maven Build.
    4. In the Goals field, enter lagom:runAll.
    5. Select the JRE tab and make sure it is pointing at a JRE associated with a JDK.
    6. Click Run.

The console should report that the services started. Verify that the services are indeed up and running by invoking the hello service endpoint from any HTTP client, such as a browser:

```
http://localhost:9000/api/hello/World
```

The request returns the message Hello, World!.

Found an error in this documentation? The source code for this page can be found here. Please feel free to edit and contribute a pull request.