Skip to content

Latest commit

 

History

History
63 lines (42 loc) · 2.32 KB

using_the_feature_launching.md

File metadata and controls

63 lines (42 loc) · 2.32 KB

Bazel Eclipse Feature: Launch Configurations

Running external processes, tests or apps (Java main methods) is supported using Bazel Launch Configurations.

Running Java apps from the IDE

The IDE delegates to "bazel run" to run Java main methods. Therefore your main method must be backed by a runnable Bazel target type. Currently, only java_binary is supported.

Example:

If you have a Bazel target in your BUILD file that looks like this:

java_binary(
    name = "fruit-salad-service",
    main_class = "demo.salesforce.salad.FruitSalad",
    ...
)

You can run FruitSalad's main method by creating a launch configuration:

  1. Navigate to Run Configurations...
  2. Create a new instance of the Bazel Target launcher
  3. Identify the project and java_binary target

You should now be able to run the fruit-salad-service app. You can also debug it, with breakpoints, by launching as a Debug Configuration.

⚠️ the standard Java application launcher (Run As Java Application) does not work.

Running Tests from the IDE

There are several paths to run (or debug) tests from BEF.

Method 1: top level Run menu

  1. Navigate to the Run menu, choose Run As... and click the New button for Bazel Target
  2. Select the project, and then the test target from the drop down.
  3. You should now be able to run the test.

You can also debug it, with breakpoints, by launching as a Debug Configuration.

Method 2: Package Explorer context menu

  1. In the Package Explorer view, click on the test folder (src/test/java), a test Java package (com.salesforce.hello), or a specific test class (HelloWorldTest.java)
  2. Right click on it, and find the Run As or Debug As item in the context menu
  3. Choose JUnit Bazel Target
  4. The JUnit view will populate with the test results

⚠️ the standard JUnit Launcher JUnit Test does not work. Issue 18 tracks that work item.

Next Topic: Explore!

This is the end of the step by step user guide. At this point you have hopefully imported your Bazel workspace and are ready to develop.

Please press the 'star' button at the top of this page if you have not already done so. This helps us get more time and resources for this project.

If you have problems using BEF, please file an Issue and we will try to help you.