Skip to content

Plugin Development

Scott Kurz edited this page Jul 7, 2022 · 26 revisions

Setting up the project

  1. Clone project from git

    git clone [email protected]:OpenLiberty/liberty-tools-eclipse.git

  2. Start up Eclipse (create a new directory to use as the workspace - not the cloned repo above^)

  3. Import the projects (multiple ways to do this):

  • Using Git

    1. Click on Window > Show View > Other...

    2. Search "git" and click on Git Repositories

    3. From the Git Repositories view, right click > Add a Git Repository

    4. Add the liberty-tools-eclipse directory that you cloned in step 1.

    5. Right click on the new repo and Import Projects

  • OR

    1. File->Import -> General -> Existing Projects into Workspace

    2. In the "Select root directory" type the liberty-tools-eclipse directory that you cloned in step 1 and hit "Browse".

    3. Click to select the option "Search for nested projects".

    4. Click "Finish".

You will now see a single top-level folder in the "Project Explorer" view. You can also switch to the Java perspective and the "Package Explorer" view to see the top-level project plus the nested child projects.

Run/Debug the Liberty Tools feature in a child Eclipse environment

  1. Setup the target platform information (versions, addons and such).

    1. Go to releng/target-platform and open target-platform.target

    2. Click Set as Active Target Platform in the top Right. (This will download plugin and feature metadata from Eclipse update sites so make take a few minutes to complete).

  2. Do a Maven build to copy the binaries in place

    1. From the top-level project, do mvn install -DskipTests=true from terminal (or right-click->Run As->Maven build ... and in the "Goals" box type in install -DskipTests=true).

    2. Navigate to the liberty-mpls project and hit <F5> (or right-click->Refresh).

  3. Launch the plugin (this will open a "child" Eclipse window with the plugin installed)

    1. Navigate to the liberty project (bundles/liberty under the top-level project)

    2. Right-click -> Run As > Eclipse Application

    • For debug set breakpoints (if desired) and do "Debug As" instead of "Run As" using the same Run/Debug Configuration
  4. Setting PATH (if necessary, you might not need if you already have it set from the parent Eclipse)

    1. Open your Run Configuration in the "Run Configurations" editor, e.g. Run As > Run Configurations > Eclipse Application

    2. From the "Environment" tab, add your PATH variable here

      • You can use the "Select" button to populate from an existing environment variable)

      • You can use the value ${env_var:PATH};<...your mvn path ...> to populate in terms of your existing PATH env var

Run tests from the command line

  1. Run all tests

    • mvn install
  2. Run a single test class (no apparent way to run individual test methods though)

    • mvn verify -DtestClass=io.openliberty.tools.eclipse.test.it.LibertyPluginSWTBotDashboardTest
  3. Run a single test class with test JVM in debug mode

    • mvn verify -DtestClass=io.openliberty.tools.eclipse.test.it.LibertyPluginSWTBotDashboardTest -DdebugPort=5005

Notes:

  • Supported Java version: 11 and 17