redhat-developer / redhat-developer/vscode-java

Lack of relocated classes information in IDE environment

Ouverte
#4,116 0 commentaires 1 réaction 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

enhancement Maven
Langage dominant
TypeScript
Étoiles
2.3k
Forks
546
Merge moyen
20 h 1 min
PR mergées (30 j)
11

Description

I'm using maven-shade-plugin in my multi module Maven Java Project.

root
|-- module-a
|-- |-- pom.xml
|-- module-b
|-- |-- pom.xml
pom.xml

module-b depents on module-a.

module-a depents on the kafka-client lib (third-party lib), and in the pom of module-a I add this to shade kafka-client lib into the final module-a Jar so that no kafka-client dependency will be passed to module-b:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.6.0</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                ...
                <!-- relocate package name -->
                <relocations>
                    <relocation>
                        <pattern>org.apache.kafka</pattern>
                        <shadedPattern>com.a.b.c.org.apache.kafka</shadedPattern>
                    </relocation>
                </relocations>
                ...
            </configuration>
        </execution>
    </executions>
</plugin>

module-b depents on module-a so it will import the relocated classes in kafka-client which is contained in module-a Jar.

But when I try to import the project into VSCode I got error "The import com.a.b.c cannot be resolved Java(268435846)" in module-b like:

Image

I think maybe vscode is not including the shaded jar into project environment?

Image

No offense, but IntelliJIDEA handled like this without error alert, project seems all good after importing:

Image

Maybe we can take it into consideration?

Thank you very much.

VS Code version: Code 1.101.2 (Universal) (2901c5ac6db8a986a5666c3af51ff804d05af0d4, 2025-06-24T20:27:15.391Z)
OS version: Darwin arm64 24.5.0
Modes:

System Info
Item Value
CPUs Apple M1 Pro (10 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 3, 5, 5
Memory (System) 32.00GB (6.13GB free)
Process Argv --crash-reporter-id 3b2bf321-aec4-445d-8da4-f00f6f54b46f
Screen Reader no
VM 0%
Extensions (46)
Extension Author (truncated) Version
vscode-sql-formatter adp 1.4.4
path-intellisense chr 2.10.0
doxdocgen csc 1.4.0
githistory don 0.6.20
prettier-vscode esb 11.0.0
code-runner for 0.12.2
shell-format fox 7.2.5
copilot Git 1.341.0
copilot-chat Git 0.28.5
plantuml jeb 2.18.1
intellij-idea-keybindings k-- 1.7.5
vscode-leetcode Lee 0.18.4
autoconf mae 0.2.0
vscode-containers ms- 2.0.3
vscode-language-pack-zh-hans MS- 1.101.2025061109
vscode-kubernetes-tools ms- 1.3.25
debugpy ms- 2025.8.0
python ms- 2025.8.1
vscode-pylance ms- 2025.6.2
remote-containers ms- 0.417.0
remote-ssh ms- 0.120.0
remote-ssh-edit ms- 0.87.0
remote-wsl ms- 0.99.0
cmake-tools ms- 1.21.36
cpptools ms- 1.26.3
cpptools-extension-pack ms- 1.3.1
hexeditor ms- 1.11.1
remote-explorer ms- 0.5.0
chatgpt ope 0.1.1741291060
java red 1.43.1
vscode-yaml red 1.18.0
any-rule rus 0.3.18
vscode-zh-convertor Ste 0.0.4
cmake twx 0.0.17
vscode-lldb vad 1.11.5
intellicode-api-usage-examples Vis 0.2.9
vscodeintellicode Vis 1.3.2
vscode-gradle vsc 3.16.4
vscode-java-debug vsc 0.58.2
vscode-java-dependency vsc 0.24.1
vscode-java-pack vsc 0.29.2
vscode-java-test vsc 0.43.1
vscode-maven vsc 0.44.0
clang-format xav 1.9.0
vscode-java-saber You 0.1.2
vscode-proto3 zxh 0.5.5
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
binariesv615:30325510
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
2e7ec940:31000449
cppperfnew:31000557
dwnewjupyter:31046869
nativeloc1:31344060
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
9064b325:31222308
copilot_t_ci:31333650
e5gg6876:31282496
pythoneinst12:31285622
4gafe986:31271826
c7cif404:31314491
pythonpulldiag:31343502
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
0aa6g176:31307128
7bj51361:31289155
747dc170:31275177
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
9d2cg352:31339597
0g0a1943:31341127
d7aab740:31338110
usemarketplace:31343026
nesew2to5:31336538
agentclaude:31335815
mytestcf:31335658
nes-diff-11:31337487
6abeh943:31336334
yijiwantestdri0626-t:31336930
4gdec884:31342391

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par reproduire le projet Maven multi-module dans VS Code et examinez comment l’environnement Java résout la dépendance de module-b envers module-a et ses classes shaded de kafka-client. Comparez cela avec la configuration fonctionnelle d’IntelliJ IDEA ; le travail est terminé lorsque les imports sous com.a.b.c sont résolus sans diagnostics Java.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
developer-experience, tooling
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.