How to download and run the Java EE 7 sample applications in Eclipse with WebSphere Developer Tools (WDT).
There are some application samples for WebSphere Application Server (WAS) V9 available on GitHub that make it easy to check out selected Java EE 7 technologies on Liberty using Eclipse with the WebSphere Developer Tools, (WDT). Here’s how you do it…
Download and install WebSphere Developer Tools for Mars Eclipse. When you create a new server and are prompted to install the Liberty runtime, select the WAS Liberty with Java EE 7 Web Profile option to get the Java EE 7 Web Profile subset of Liberty features.
If you’re new to WDT, take a look at Getting started with WebSphere Developer Tools for Eclipse and Liberty.
You should immediately see that the new Liberty server has been added. Don’t worry about any errors for now. The
server.xml will get updated later.
Cloning a project from GitHub using Eclipse
The next step is to choose a sample from GitHub and clone it on to your local Eclipse machine:
- In Eclipse, click Window > Show View > Other.
- Expand Git.
- Select Git Repositories, then click OK.
- You will now see a Git Repositories tab and three links. Click the Clone a Git Repository link.
- Type in the URL for the repository you wish to clone (do not add ‘www’ to the domain, as this will fail). For example:
- Follow the rest of the wizard but do take note of the destination folder where you save the repo.
Import your local Maven clone project into Eclipse
To get the Maven project into Eclipse:
- Click File > Import.
- Expand Maven, select Existing Maven Projects, then click Next.
- Click Browse, navigate to the cloned project and select it. For example, I saved mine to
- You should see the items selected and listed under a
pom.xmlitem that is also selected. If so, Click Finish.
- Check the instructions in the
README.mdfor the sample in case there are any specific instructions to do any extra setup or provisioning that might be necessary. The
README.mdshould tell you what changes to make to your ‘server.xml’.
Building the sample
To do the Maven build stuff (compiling and creating the build file):
- Right-click the sample project, then click Run as > Maven > Install
Running the sample
Linking the runtime in Eclipse to our sample allows code changes to be incrementally published to the server and run immediately:
- Right-click the Liberty server in the Servers tab.
- Click Add and Remove…, then add the sample.javaee7 project to the server.
- Click Finish.
- Start the server.
- When you see the link that says localhost:9080/sample_name/ in the console output, click it to bring up the sample application.
If you have any questions, ask them on Stack Overflow.
If you’re interested in trying out more Java EE 7 samples, Kevin Sutter has written about how to run the industry open source Java EE 7 samples on Liberty.