Tools
First, I installed the following:
- WebSphere Liberty Profile (v8.5.5.3)
- Eclipse Luna for JEE Developers (comes with the maven plugin)
- Maven (v3.2.3)
Maven Configuration
Next I configure Eclipse to use the version of Maven I just installed instead of the bundled version by:- Going to Window > Preferences > Maven > Installations.
- Clicking the Add... button.
- Setting the Installation type to external.
- Clicking the Directory button and browsing to the location where I installed Maven.
- Clicking OK.
The resulting dialog should look something like this:
Click Finish to complete the configuration. Back on the Maven Installation Preference dialog, I select the entry I just created.
Finally, I click OK to apply the changes and close the Preferences window.
WebSphere Liberty Profile Developer Tools
Next I install the WebSphere Liberty Profile Development Tools from the Eclipse Marketplace by:
- Clicking on Help > Eclipse Marketplace...
- Typing into the Find field a search of Liberty.
- Scrolling down the result list to the entry titled IBM WebSphere Application Server Liberty Profile Developer Tools for Luna.
- Clicking the Install button.
- When enabled, clicking the Confirm button.
- Accepting the license agreement and clicking Finish.
The plugin installs and prompts me to restart Eclipse and I click the Yes button to execute.
Note: Sometime I get an error during the installation. When this happens, I delete the artifacts.xml file from within the installation directory of Eclipse and restart Eclipse using the -clean command line argument.
Configuring JEE Maven Project Settings
I like to use the maven directory structure for all of my projects. This structure is not the default structure used by Eclipse though and can cause issues with dynamic web projects. This can be updated byt:
- Accessing Windows > Java EE > Maven > Maven Project Settings.
- Click the Set all Maven values button at the top of the screen.
- Click the Apply button at the bottom of the screen.
New JEE projects will now be created using the default maven directory structure.
Configuring settings.xml for Maven
Update: This feature now working with the latest release of the plugin. Execute the following steps:
This is where I usually start running into issues. The first step is to configure my Maven settings.xml file with the location of the IBM Maven repository for WebSphere. I should be able to access Windows > Preferences > Java EE > Maven > Maven Repository Initialization and have the Liberty plugin configure my settings.xml for me, but this fails with the following error:
- From within Eclipse, access Windows > Preferences > Java EE > Maven > Maven Repository Initialization.
- Click on the configure button.
This will create / update your local setting.xml file to include the IBM Maven repository.
Coping the global settings.xml from the conf directory of the Maven installation directory to my user's .m2 directory. (For example: cp /opt/apache-maven-3.2.3/conf/settings.xml ~/.m2/.)Opening my settings.xml is a text editor.Add the following XML snippet to the <profiles> element:Add was-dev-profile to the active profiles list:Save the changes and close the text editor.
Populating My Local Repository
The Liberty plugin comes with Maven POM files that can be used to populate a user's local Maven repository with the libraries that are installed with the Liberty profile. I use these POM files to populate my local repository by:
- Using a terminal window to access the Liberty plugin's installation directory within the Eclipse installation directory (For example: /opt/eclipse/plugins/com.ibm.etools.maven.javaee.core_1.1.1.v20140602_0512).
- Using the terminal window to locate the Liberty plugin installer pom.xml (For example: /opt/eclipse/plugins/com.ibm.etools.maven.javaee.core_1.1.1.v20140602_0512/resources/scripts/Liberty 8.5.5 Fix Pack 1 Plugins installer)
- Using Maven to execute the pom.xml in this directory. I have to pass a property containing the installation directory of Liberty to Maven. (For example: mvn install -DserverInstallationFolder=/opt/IBM/WebSphere/Liberty)
Unfortunately, pom files are only provide in support of v8.5.5.0 and v8.5.5.1. The maven build resulted in an error for me with v8.5.5.3 because the names of the individual jars files provided by Liberty include the version number and that version number can change with each release. To get around this issue, I created a simple Java program that will build POM files for me based on the installed version of Liberty. I have the code for the tool available on GitHub with instructions on how to use it:
https://github.com/tglawless/jee/tree/master/was-pom-builder
https://github.com/tglawless/jee/tree/master/was-pom-builder



No comments:
Post a Comment