Developer Environment

Integrated Development Environments (IDEs) can help you develop your own custom SysML v1 or SysML v2 delegate modules much more easily and error free than if you were to use a simple text editor and Command Prompt. If you choose to use an IDE, you can configure it however you like, and with whatever build tool you like. To get you started, here are some recommendations for configuring the following IDEs to use Gradle:

You should have already installed Java, Gradle, and your IDE before following these steps.

Eclipse

Import your delegate project

  1. In Eclipse, select File > Import.
  2. If the Welcome page pops up, you can just click Next >.
  3. Select Gradle > Existing Gradle Project and then click Next >.
  4. Browse... to your delegate source code directory and click Next >.
  5. If this is the first time you are importing a Gradle project, click Configure Workspace Settings....

    Figure 3: Importing a Gradle project into Eclipse

    Follow these substeps to configure Gradle:
    1. If you are familiar with using a Gradle wrapper then you can select it and configure your Gradle project accordingly. Otherwise, you should just Browse... to your Local installation directory of Gradle (the top-level gradle-#.# directory, not the bin directory).
    2. Leave your Gradle user home empty to use the default (C:\Users\<username>\.gradle).
    3. Browse... to your Java home (e.g., C:\Program Files\Java\jdk-17).

      Figure 4: Recommended Gradle configuration in Eclipse

    4. Click Apply and Close.
  6. Click Finish.

Attach Java API Documentation

For Eclipse, examples of enabling Java API Documentation automatically with Gradle are provided in the "samples" folder within the install directory. Use the following table to determine which sample to explore depending on your target SysML version.

Target SysML Version Sample build.gradle File Location
SysML v1 <BEE Install Directory>/samples/build/build.gradle
SysML v2 <BEE Install Directory>/samples/sysml2/build/build.gradle

Configure content assist

If you would like to modify Eclipse's default Java code suggestions, follow these steps:

  1. Select Window > Preferences.
  2. In the left sidebar, select Java > Editor > Content Assist > Advanced.
  3. Select your preferred options. You probably want to select both Java Proposals and Java Type Proposals.
  4. Click Apply and Close.

Create a debug configuration

Attach the Eclipse debugger by creating a debug configuration.

  1. Select Run > Debug Configurations....
  2. In the left sidebar, select Remote Java Application and click the New Configuration button in the upper left.
  3. Name the configuration and Browse... to your delegate module project.
  4. Leave the Host as localhost and set the Port to 5005.
  5. Click Debug.

After you have created the configuration and attached with it once, you can attach in the future by just clicking the Debug button again.

IntelliJ IDEA

Import your delegate project

  1. In IntelliJ IDEA, select File > Open or, if IntelliJ IDEA opens to a Welcome page, just click Open.
  2. Select your delegate source code directory and click OK.
  3. Click Trust Project and, if given the choice, choose a window to open your project in.
  4. If IntelliJ IDEA reported a Sync error when opening your project, follow these substeps to configure Gradle:
    1. Select File > Settings.
    2. In the left sidebar, select Build, Execution, Deployment > Build Tools > Gradle.
    3. Leave your Gradle user home empty to use the default (C:\Users\<username>\.gradle).
    4. If you are familiar with using a Gradle wrapper, then you can Use Gradle from a 'gradle-wrapper.properties' file, but you will need to configure your Gradle project for that. Otherwise, you should just Use Gradle from the Specified location of your Gradle installation (the top-level gradle-#.# directory, not the bin directory).
    5. Select your Gradle JVM, adding a new JDK if necessary (e.g., C:\Program Files\Java\jdk-17).

      Figure 5: Recommended Gradle configuration in IntelliJ IDEA

    6. Click OK.

Attach Java API Documentation

To see Java API Documentation for the module libraries inside Intellij IDEA, follow these steps:

  1. Select File > Project Structure to open the Project Structure window.
  2. Select Modules in the left sidebar
  3. Select the main module. Usually this would be a module called main that can be found after expanding the module with the same name as the project.
  4. Navigate to the Dependencies tab in the right sidebar.
  5. Find the API library you want to attach documentation to. See the chart below for attachable libraries.
  6. Double-click the API library to open the Configure Module Library window.
  7. If you do not see a JavaDocs folder, press the Add (+) button in the top left of the Configure Module Library window to open a directory picker prompt.
  8. Navigate to the corresponding documentation directory for the API library you are seeking documentation for. Highlight the corresponding directory and press OK. After selecting the directory, make sure that you choose JavaDocs and press OK. Even if the directory chosen is correct, IntelliJ will not know what kinds of files it contains and prompt for clarification via a popup dialogue. Reference the table below for the correct Java API Documentation folder to select for each library:
    API LibrariesJava API Documentation Folders
    • moxie-api
    • moxie-delegates
    <BEE Install Directory>/documentation/javadoc/bee
    • moxie-stk-utilities
    • moxie-stk-delegates
    <BEE Install Directory>/documentation/javadoc/stk
    • com.agi.mbse.sysml2.api
    <BEE Install Directory>/documentation/javadoc/sysml2
  9. You should now see a "JavaDocs" folder attached to your module library. Press OK to exit the Configure Module Library window, then press OK to exit the Project Structure window.

Older versions of Intellij IDEA have issues resolving paths that include spaces, which can affect one's ability to attach documentation via the above steps. To circumnavigate this issue, try copying the Java API Documentation folders into paths that do not contain spaces and follow the above steps again.

Configure code completion

If you would like to modify IntelliJ IDEA's default Java code suggestions, follow these steps:

  1. Select File > Settings.
  2. In the left sidebar, select Editor > General > Code Completion.
  3. Select your preferred options. You probably want to select both Basic Completion and Type-Matching Completion.
  4. Click OK.

Attach the debugger

In IntelliJ, you do not need to set up any debug configurations. If the SysML Client is in Debug Mode, you can attach by following these steps:

  1. Select Run > Attach to Process....
  2. Select debug port: 5005.

VS Code

Install required extensions

  1. In VS Code, click the Extensions icon on the left.
  2. Using the search bar, find and install the following extensions:
    1. Language Support for JavaTM by Red Hat
    2. Debugger for Java
    3. Gradle for Java
  3. Restart VS Code.

Import your delegate project

  1. In VS Code, select File > Open Folder.
  2. Select your delegate source code directory and click Select Folder.
  3. Click Yes, I trust the author.
  4. Select View > Command Palatte... (or press CtrlShiftP).
  5. Search for and select Preferences: Open User Settings (JSON).
  6. Add the following lines to the JSON file, replacing the paths to your Java or Gradle homes if necessary (make sure to use forward slashes in these paths):
    "java.jdt.ls.java.home": "C:/Program Files/Java/jdk-17",
    "java.import.gradle.home": "C:/Gradle/gradle-7.2",
    "java.import.gradle.wrapper.enabled": false,
  7. Restart VS Code.

Create a debug configuration

VS Code requires a separate debug configuration for each project.

  1. In VS Code, select the Run and Debug icon on the left.
  2. Click create a launch.json file.
  3. In the Select Debugger shortcut menu, select Java.

    Figure 6: Creating a debug configuration in VS Code

  4. Select Run > Add Configuration.
  5. In the list of available configurations, select Java: Attach to Process.
  6. Delete the Launch Current File configuration settings from launch.json.

    Figure 7: Recommended debug configuration in VS Code

  7. Save launch.json.

Attach the debugger

You can attach the VS Code debugger by following these steps:

  1. Select Run > Start Debugging.
  2. Select the process with debug port: 5005.