-
Notifications
You must be signed in to change notification settings - Fork 14
Plugin Development
-
Clone project from git
git clone git@github.com:OpenLiberty/liberty-tools-eclipse.git
-
Start up Eclipse (create a new directory to use as the workspace - not the cloned repo above^)
-
Import the projects (multiple ways to do this):
-
Using Git
-
Click on Window > Show View > Other...
-
Search "git" and click on
Git Repositories -
From the
Git Repositoriesview, right click >Add a Git Repository -
Add the
liberty-tools-eclipsedirectory that you cloned in step 1. -
Right click on the new repo and
Import Projects
-
-
OR
-
File->Import -> General -> Existing Projects into Workspace
-
In the "Select root directory" type the
liberty-tools-eclipsedirectory that you cloned in step 1 and hit "Browse". -
Click to select the option "Search for nested projects".
-
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.
-
Setup the target platform information (versions, addons and such).
-
Go to
releng/target-platformand opentarget-platform.target -
Click
Set as Active Target Platformin the top Right. (This will download plugin and feature metadata from Eclipse update sites so make take a few minutes to complete). -
If you get red X(s), iteratively do Project->Clean (and let it rebuild automatically) and then hit the
Set as Active Target Platformagain and wait for the X(s) to go away. No idea why this is sometimes needed.
-
-
Do a Maven build to copy the binaries in place
-
From the top-level project, do
mvn install -DskipTests=truefrom terminal (or right-click->Run As->Maven build ... and in the "Goals" box type ininstall -DskipTests=true). -
Navigate to the
liberty-mplsproject and hit<F5>(or right-click->Refresh).
-
-
Launch the plugin (this will open a "child" Eclipse window with the plugin installed)
-
Navigate to the
libertyproject (bundles/libertyunder the top-level project) -
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
-
-
Setting PATH (if necessary, you might not need if you already have it set from the parent Eclipse)
-
Open your Run Configuration in the "Run Configurations" editor, e.g. Run As > Run Configurations > Eclipse Application
-
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 all tests
- mvn install
-
Run a single test class (no apparent way to run individual test methods though)
- mvn verify -DtestClass=io.openliberty.tools.eclipse.test.it.LibertyPluginSWTBotDashboardTest
-
Run a single test class with test JVM in debug mode
- mvn verify -DtestClass=io.openliberty.tools.eclipse.test.it.LibertyPluginSWTBotDashboardTest -DdebugPort=5005
-
Install the SWTBot feature
- Help -> Eclipse MarketPlace -> (type "swtbot" ) click "Install" button, etc.
-
Configure the test Run/Debug configuration
-
Right-click 'tests' project, "Run As -> Run Configurations" select "JUnit Plug-in Test" and click "New launch configuration" button in the upper-left. (Or, just do "Run As->JUnit Plug-in Test" and let Eclipse generate the run configuration for you even though it won't work the first time).
-
In the "Test" tab of the run configuration editor (the first one selected by default) UNCHECK the "Run in UI thread" checkbox. Otherwise the tests will hang.
- You can adjust configuration to run a test selection other than all tests. You can also set env vars if necessary in the "Environment" tab.
- Note the "Test runner" drop-down selection should show "JUnit 5".
-
Click "Run" to run the tests in a child Eclipse defined via the target platform.
-
NOTE: You can use the same configuration with "Debug As" to step through code in the debugger while exercising the tests.
- Supported Java version: 11 and 17