These instructions are common with other WebSphere samples on WASdev. They are not yet complete for this particular sample, however. Though they provide some value in sketching out how one might ultimately bring this sample into WDT, this does not contain a complete sequence of working steps, so be forewarned !
The WebSphere Development Tools (WDT) for Eclipse can be used to control the server (start/stop/dump/etc.), it also supports incremental publishing with minimal restarts, working with a debugger to step through your applications, etc.
WDT also provides:
- content-assist for server configuration (a nice to have: server configuration is minimal, but the tools can help you find what you need and identify finger-checks, etc.)
- automatic incremental publish of applications so that you can write and test your changes locally without having to go through a build/publish cycle or restart the server (which is not that big a deal given the server restarts lickety-split, but less is more!).
Installing WDT on Eclipse is as simple as a drag-and-drop, but the process is explained [on wasdev.net] wasdev-wdt.
If the sample git repository hasn't been cloned yet, WDT has git tools integrated into the IDE:
- Open the Git repositories view
- Window -> Show View -> Other
- Type "git" in the filter box, and select Git Repositories
- Copy Git repo url by finding the textbox under "HTTPS clone URL" at the top of this page, and select Copy to clipboard
- In the Git repositories view, select the hyperlink
Clone a Git repository - The git repo url should already be filled in. Select Next -> Next -> Finish
- The "sample.batch.bonuspayout [master]" repo should appear in the view
This assumes you have the Gradle IDE tools installed into Eclipse.
- In the Git Repository view, expand the bonuspayout repo to see the "Working Directory" folder
- Right-click on this folder, and select Copy path to Clipboard
- Select menu File -> Import -> Gradle -> Gradle Project
- In the Root folder textbox, Paste in the repository directory.
- Click Build Model
- Select all the projects (there should be three) and click Finish
- This will create 3 projects in Eclipse: batch-bonuspayout, batch-bonuspayout-application, and batch-bonuspayout-wlpcfg
⭐ Note: If you did not use Eclipse/WDT to clone the git repository, follow from step 3, but navigate to the cloned repository directory rather than pasting its name in step 4.
- In the Git Repository view, expand the bonuspayout repo to see the "Working Directory" folder
- Right-click on this folder, and select Copy path to Clipboard
- Select menu File -> Import -> Maven -> Existing Maven Projects
- In the Root Directory textbox, Paste in the repository directory.
- Select Browse... button and select Finish (confirm it finds 3 pom.xml files)
- This will create 3 projects in Eclipse: batch-bonuspayout, batch-bonuspayout-application, and batch-bonuspayout-wlpcfg
⭐ Note: If you did not use Eclipse/WDT to clone the git repository, follow from step 3, but navigate to the cloned repository directory rather than pasting its name in step 4.
For the purposes of this sample, we will create the Liberty server (step 3 in the wasdev.net instructions) a little differently to create and customize a Runtime Environment that will allow the server to directly use the configuration in the batch-bonuspayout-wlpcfg project.
- Open the 'Runtime Explorer' view:
- Window -> Show View -> Other
- type
runtimein the filter box to find the view (it's under the Server heading).
- Right-click in the view, and select New -> Runtime Environment
- Give the Runtime environment a name, e.g.
wlp-2015.6.0.0if you're using the June 2015 beta. - Either:
- Select an existing installation (perhaps what you downloaded earlier, if you followed those instructions), or
- select Install from an archive or a repository to download a new Liberty archive.
- Follow the prompts (and possibly choose additional features to install) until you Finish creating the Runtime Environment
- Right-click on the Runtime Environment created above in the 'Runtime Explorer' view, and select Edit
- Click the
Advanced Options...link - If the
batch-bonuspayout-wlpcfgdirectory is not listed as a User Directory, we need to add it:- Click New
- Select the
batch-bonuspayout-wlpcfgproject - Select Finish, OK, Finish
- Right-click on the
batch-bonuspayout-wlpcfguser directory listed under the target Runtime Environment in the Runtime Explorer view, and select New Server. - The resulting dialog should be pre-populated with the
BonusPayoutLiberty profile server. The default name for this server can vary, you might also opt to rename it from the Right-click menu in the Servers view to make it easier to identify. - Click Finish
- Select the
batch-bonuspayout-applicationproject - Right-click -> TODO
- Select the appropriate server (as created above) and select Finish
⭐ Note: Some versions of WDT incorrectly map the cdi-1.2 dependency to the CDI 1.0 Facet, which prevents the Run As ... operation in step 2 from succeeding. If this happens, Right-click on the async-jaxrs-application project, and select Properties, then select Project Facets in the left-hand pane. Change the the "Context and dependency injection (CDI)" facet to use version 1.2, at which point, step 2 (above) should work.
- When importing the existing maven project into Eclipse, Eclipse will (by default) "helpfully" add this project to an (extraneous) ear. To turn this off, go to Preferences -> Java EE -> Project, and uncheck "Add project to an EAR" before you import the project. If you forgot to do this, just delete the ear project; no harm.