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

Source classes location issue #791

Closed
marcin-olejarczyk opened this issue Nov 2, 2023 · 11 comments · Fixed by #795, #798, #820, #821 or #822
Closed

Source classes location issue #791

marcin-olejarczyk opened this issue Nov 2, 2023 · 11 comments · Fixed by #795, #798, #820, #821 or #822

Comments

@marcin-olejarczyk
Copy link

I have installed SAP Commerce 2211 locally using CX recipe, all working fine. Then I imported this local SAP Commerce project to IntelliJ using your SAP Commerce Developers Toolset plugin without any issue (Project imported successfully).

Unfortunately, IDE is not able to locate source classes properly, for example, DefaultDeliveryService:
image

All classes are found in the class compiler output folder:

image

but not in the original src folder, even properly imported by your plugin:

image

I did some investigation, and my conclusion is related to the destination class path:
SAP Commerce builds and places all module compiled classes under the class folder,
SAP Commerce Developers Toolset configures all modules with compiled classes under eclipsebin folder,
image

@mlytvyn
Copy link
Collaborator

mlytvyn commented Nov 2, 2023

hello @marcin-olejarczyk , that's how it was originally designed by the Plugin authors - separate IDEA compilation from Ant compilation.
please, take a note that SAP Commerce is not shipped with sources for every module, some of them are located in the <module>server.jar.
on other hand, there are few additional project import / refresh flags:

1st - Import OOTB modules in read-only mode

  • OOTB modules will be imported in read-only mode
  • any src folders will not be registered as source or test-source directories (it will be adjusted in 2023.2.11)
  • on other hand, they will be included in the <module> - compiler output library
  • it was done to improve in-IDEA compilation performance, when you run Unit tests or just checking the compilation

2nd - Exclude test sources for OOTB modules

  • when checked, test-source directories will not be registered even when 1st flag set to true
  • this was also done to improve compilation time, when OOTB modules imported in non-read-only mode.

p.s. if you would like to clarify this further or have any suggestions feel free to reach me out in the Plugin's Slack and we can discuss it verbally.

@marcin-olejarczyk
Copy link
Author

marcin-olejarczyk commented Nov 2, 2023

Hi @mlytvyn Thanks for your answer.

Right, not every module is delivered with sources, but most of them are - for example, commerce-services module is delivered with sources as we can see from the screenshot example.
image

Not sure if it is related with the separate IDEA compilation from Ant compilation, but we are getting a lot of errors like:
image

What do you mean by (it will be adjusted in 2023.2.11) in relation to 'any src folders will not be registered as source or test-source directories'?

@mlytvyn
Copy link
Collaborator

mlytvyn commented Nov 3, 2023

@marcin-olejarczyk , original plugin was designed in a way that all OOTB classes will be available via module specific Lib in case of read-only mode. It was done with intention to simulate Ant class path configuration behaviour. Indeed, it does not always work well with SAP Commerce addon approach.

In most cases such addon compilation issues caused by incomplete extension dependencies.
Deep investigation may be required, I'll try with my sample project setup (without any guarantee) and would like to see some new contributors ;)

p.s. Library usually has both classes and sources (if available)

@mlytvyn
Copy link
Collaborator

mlytvyn commented Nov 3, 2023

@marcin-olejarczyk , looks like good news :) there was an issue in legacy code:
when source files located in the ignored directories and are part of the library, IDEA will not properly respect them as members of the Project and will go "crazy" with class path resolution.

Please wait for next 2023.2.11 (to be released some day next week).

I hope it will help you and other developers. Once again, thank you for your feedback, only thanks to every such feedback we can make this free Plugin better.

@mlytvyn mlytvyn closed this as completed Nov 3, 2023
@mlytvyn mlytvyn added this to the Release 2023.2.11 milestone Nov 3, 2023
@marcin-olejarczyk
Copy link
Author

Hi @mlytvyn Good news. One additional note from my side: I have the impression that the problems described here appeared with the IntelliJ 2023.2.0, but maybe I am wrong.

I'm looking forward to your new plugin version. I hope it will fix our issue with the new plugin release 🤞

@marcin-olejarczyk
Copy link
Author

Hi @mlytvyn I downloaded and installed the latest SAP Commerce IntelliJ IDEA Plugin 2023.2.11 ver. and then refreshed the project and cleaned IDE caches.

Unfortunately, I still can see IDE issues for the SAP Commerce 2211 project build with the CX recipe (no any customisation from my side):
image

Please advise me how to deal with this problem.

@mlytvyn
Copy link
Collaborator

mlytvyn commented Nov 8, 2023

@marcin-olejarczyk , most probably it is related to this issue -> #729 (comment).

I'll check if it's so...

@mlytvyn mlytvyn reopened this Nov 8, 2023
@tomtrapp
Copy link

+1
I'm having the same issues with the latest IntelliJ and Plugin version

@felipekunzler
Copy link

Similar issue on my end using IntelliJ 2023.2.5 and plugin 2023.2.12

@mlytvyn
Copy link
Collaborator

mlytvyn commented Dec 4, 2023

@tomtrapp , @felipekunzler , @marcin-olejarczyk , pushed 3 extra changes related to the classpath, let's hope that they will help for addons / web / acceleratoraddon modules.

Backoffice classpath issue is still pending on Jetbrains.

I'll request release of the 2023.2.13 this week, please check your projects on new release after the project refresh... and thanks in advance.

@mlytvyn mlytvyn linked a pull request Dec 4, 2023 that will close this issue
@felipekunzler
Copy link

Hi @mlytvyn. The fix worked for me, classes are now correctly referenced on controller addons when using 2023.2.13.
Appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment