§Importing an sbt project into Eclipse
If you used the Giter8 template to create a build as described in the Getting Started section, you will have an sbt build project. To make it possible to import the project into Eclipse, sbt provides an sbt-eclipse plugin that generates Eclipse project artifacts for each of the subprojects.
Follow these steps to integrate your project with Eclipse:
§Import the project
In a console,
cdto the top-level folder of your existing sbt project, and enter
sbt eclipseto generate the Eclipse project files for all projects in your build.
The sbt plugin creates
.classpathfiles for the subprojects. The last few lines of output confirm success:
... [info] Successfully created Eclipse project files for project(s): [info] hello-impl [info] hello-api [info] hello-stream-impl [info] hello-stream-api [info] lagom-internal-meta-project-service-locator [info] lagom-internal-meta-project-cassandra
Start Eclipse and switch to the Workspace you want to use for your Lagom project.
From the File menu, select Import.
The Select screen opens.
Expand General, select Existing Projects into Workspace and click Next.
The Import Projects page opens.
- Optionally, select Copy projects into workspace.
- Click Finish.
§Create an External Tool Configuration
- From the Eclipse toolbar, click External Tools and select External Tools Configurations.
- In the left pane, select Program and click New Launch Configuration.
- Create your configuration as follows:
- Enter a name.
- On the Main tab in the Location field, enter the location of your sbt installation.
For Windows, browse to the location where you installed sbt and select
sbt.bat. On Linux, you can find the location of sbt by opening a terminal and entering
- For Working Directory browse to the top-level sbt project folder. (This is the folder containing the
- In the Arguments field, enter
- Click Apply. Your screen should look similar to the following:
- Click Run.
Verify that the services are indeed up and running by invoking the
hello service endpoint from any HTTP client, such as a browser:
The request returns the message