Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix][build] Add basic support for vscode-java and Eclipse IDE #23448

Merged
merged 3 commits into from
Oct 14, 2024

Conversation

lhotari
Copy link
Member

@lhotari lhotari commented Oct 12, 2024

Motivation

Visual Studio Code (vscode) is a popular IDE. It would be great to support developing Pulsar with vscode-java.
One of the reasons for adding vscode-java support is due to Cursor AI code editor building upon vscode. When there's vscode-java support in Pulsar, it would be possible to use Cursor for developing Pulsar.

Similar changes are most likely required for supporting Eclipse for Apache Pulsar development since vscode-java uses Eclipse modules under the covers for Java and Maven support.

The lightproto maven plugin issue most likely impacts IntelliJ too since currently you need to build Pulsar once in order to get lightproto generated classes to resolve. This change will most likely address that issue too.

Modifications

Example test run

image

Additional context

UPDATE: Please see Setting up an IDE to setup VS Code for Pulsar development.

I got test running working with this settings.json for "Language Support for Java(TM) by Red Hat" extension

{
    "java.jdt.ls.vmargs": "-Xmx8g -XX:+UseZGC -XX:+ZGenerational -Dsun.zip.disableMemoryMapping=true",
    "java.jdt.ls.java.home": "~/.sdkman/candidates/java/21",
    "java.configuration.runtimes": [
        {
            "name": "JavaSE-21",
            "path": "~/.sdkman/candidates/java/21",
            "default": true
        },
        {
            "name": "JavaSE-17",
            "path": "~/.sdkman/candidates/java/17"
        },
        {
            "name": "JavaSE-11",
            "path": "~/.sdkman/candidates/java/11"
        },
        {
            "name": "JavaSE-1.8",
            "path": "~/.sdkman/candidates/java/8"
        }
    ],
    "java.autobuild.enabled": false,
    "java.debug.settings.onBuildFailureProceed": true,
    "java.compile.nullAnalysis.mode": "disabled",
    "java.configuration.updateBuildConfiguration": "interactive"
}

sdkman setup for JDK versions is explained currently in https://pulsar.apache.org/contribute/release-process/#preparation

in workspace level settings.json

{
    "maven.executable.options": "-Pcore-modules,-main"
}

configured in
image

Also setting -Pcore-modules,-main to speed up compilation

image

Also setting profiles in the root project:
image

Since "java.autobuild.enabled": false, you will need to build manually. Having autobuilding disabled is useful for a large project like Pulsar since building will consume resources and it conflicts with manual builds on the command line.

image

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@lhotari lhotari added this to the 4.1.0 milestone Oct 12, 2024
@lhotari lhotari self-assigned this Oct 12, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Oct 12, 2024
@codecov-commenter
Copy link

codecov-commenter commented Oct 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.37%. Comparing base (bbc6224) to head (e27fb4d).
Report is 672 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23448      +/-   ##
============================================
+ Coverage     73.57%   74.37%   +0.79%     
- Complexity    32624    34401    +1777     
============================================
  Files          1877     1943      +66     
  Lines        139502   146919    +7417     
  Branches      15299    16179     +880     
============================================
+ Hits         102638   109267    +6629     
- Misses        28908    29231     +323     
- Partials       7956     8421     +465     
Flag Coverage Δ
inttests 27.58% <ø> (+3.00%) ⬆️
systests 24.39% <ø> (+0.07%) ⬆️
unittests 73.75% <ø> (+0.90%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 655 files with indirect coverage changes

@lhotari lhotari changed the title [fix][build] Add basic support for vscode-java [fix][build] Add basic support for vscode-java and Eclipse IDE Oct 14, 2024
@lhotari lhotari merged commit 209fd78 into apache:master Oct 14, 2024
65 of 67 checks passed
@BewareMyPower
Copy link
Contributor

image

It works in my local env now. Just a note that the -XX:+ZGenerational option should be removed from the @ext:redhat.java's settings.json if you're using Java 17.

@lhotari lhotari modified the milestones: 4.1.0, 4.0.0 Oct 14, 2024
lhotari added a commit that referenced this pull request Oct 14, 2024
lhotari added a commit that referenced this pull request Oct 14, 2024
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Oct 15, 2024
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants