Closed mattdibi closed 1 year ago
Update: apparently it works with
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?pde version="3.8"?><target name="Kura Target Platform Equinox 3.16.0" sequenceNumber="47">
<locations>
<location path="${project_loc:kura/target-definition}/target-definition/common/repository/plugins" type="Directory"/>
<location path="${project_loc:kura/target-definition}/target-definition/equinox_3.16.0/repository/plugins" type="Directory"/>
<location path="${project_loc:kura/target-definition}/target-definition/test-deps/repository/plugins" type="Directory"/>
</locations>
</target>
and also with:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?pde version="3.8"?><target name="Kura Target Platform Equinox 3.16.0" sequenceNumber="47">
<locations>
<location path="${container_loc:/kura/target-definition/common/repository/plugins}" type="Directory"/>
<location path="${container_loc:/kura/target-definition/equinox_3.16.0/repository/plugins}" type="Directory"/>
<location path="${container_loc:/kura/target-definition/test-deps/repository/plugins}" type="Directory"/>
</locations>
</target>
but, the first time the project is opened with VSCode, the Java build fails and the LSP log reports the same errors as per my first comment. If you
the build succeeds and the diagnostics are working properly.
Note: This is only needed once. When you first open the project with VSCode.
Since vscode-pde extension uses the same pde plugins as Eclipse, I'm wondering if Eclipse can support such variable references in tp file well?
but, the first time the project is opened with VSCode, the Java build fails. If you
Close VSCode and re-open it OR Click on "Reload Target-Platform" and then "Reload all Maven projects" the build succeeds and the diagnostics are working properly.
Yes, reloading VS Code is a good workaround. Sometimes vscode-pde still uses the old tp contents from the cache, and reloading VS Code can usually solve it.
Since vscode-pde extension uses the same pde plugins as Eclipse, I'm wondering if Eclipse can support such variable references in tp file well?
Well... these variables are the one provided in the dedicated UI.
Yes, reloading VS Code is a good workaround. Sometimes vscode-pde still uses the old tp contents from the cache, and reloading VS Code can usually solve it.
Actually it looks like as if they're not populated the first time you open the project. Upon reloading they're populated and everything is resolved correctly...
Edit: Looks like this is a long-standing bug in the Eclipse codebase: https://bugs.eclipse.org/bugs/show_bug.cgi?id=501393
@testforstephen I performed a couple more experiments and I think the only real issue/weird behaviour is the fact that it doesn't recognize the ${git_work_tree}
variable while it works flawlessly on Eclipse IDE.
As a workaround for our project, I think we'll stick with the ${container_loc}
variable and subsequent "Developer: Reload Window" command which looks like it works quite well.
Feel free to close this if you think this can be good approach for anyone with the same issue.
Anyway, thanks for your feedback :)
Good findings. I will close it since you have a workaround. If we receive more feedback from other users with similar use cases, we can revisit it again.
Hello there,
first and foremost: thank you for this awesome extension!
I encountered this issue while adding VSCode support to our project. Details here.
I'm using vscode-pde extension with Language Support for Java(TM) by Red Hat to achieve this.
Our current target definition looks like this:
When I open the project with VSCode as-is I get:
See full log
``` !ENTRY org.eclipse.jdt.ls.core 1 0 2023-04-15 09:18:50.746 !MESSAGE Finished creating the Java project jdt.ls-java-project !ENTRY org.eclipse.core.variables 4 120 2023-04-15 09:18:51.156 !MESSAGE Reference to undefined variable git_work_tree !ENTRY org.eclipse.core.variables 4 120 2023-04-15 09:18:51.157 !MESSAGE Reference to undefined variable git_work_tree !ENTRY org.eclipse.core.variables 4 120 2023-04-15 09:18:51.158 !MESSAGE Reference to undefined variable git_work_tree !ENTRY org.eclipse.pde.core 4 0 2023-04-15 09:18:51.170 !MESSAGE Reference to undefined variable git_work_tree !STACK 1 org.eclipse.core.runtime.CoreException: Reference to undefined variable git_work_tree at org.eclipse.core.internal.variables.StringSubstitutionEngine.resolve(StringSubstitutionEngine.java:263) at org.eclipse.core.internal.variables.StringSubstitutionEngine.substitute(StringSubstitutionEngine.java:195) at org.eclipse.core.internal.variables.StringSubstitutionEngine.performStringSubstitution(StringSubstitutionEngine.java:91) at org.eclipse.core.internal.variables.StringVariableManager.performStringSubstitution(StringVariableManager.java:547) at org.eclipse.core.internal.variables.StringVariableManager.performStringSubstitution(StringVariableManager.java:347) at org.eclipse.pde.internal.core.target.AbstractBundleContainer.resolveVariables(AbstractBundleContainer.java:80) at org.eclipse.pde.internal.core.target.ProfileBundleContainer.resolveHomeLocation(ProfileBundleContainer.java:260) at org.eclipse.pde.internal.core.target.ProfileBundleContainer.getLocation(ProfileBundleContainer.java:94) at org.eclipse.pde.core.plugin.TargetPlatform.getLocation(TargetPlatform.java:75) at org.eclipse.pde.internal.core.EclipseHomeInitializer.resetEclipseHomeVariable(EclipseHomeInitializer.java:36) at org.eclipse.pde.core.target.LoadTargetDefinitionJob.resetPlatform(LoadTargetDefinitionJob.java:180) at org.eclipse.pde.core.target.LoadTargetDefinitionJob.runInWorkspace(LoadTargetDefinitionJob.java:145) at org.eclipse.jdt.ls.importer.pde.internal.PDEProjectImporter.initializeProjects(PDEProjectImporter.java:101) at org.eclipse.jdt.ls.importer.pde.internal.PDEProjectImporter.importToWorkspace(PDEProjectImporter.java:77) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.importProjects(ProjectsManager.java:148) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:111) at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:246) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) !SUBENTRY 1 org.eclipse.core.variables 4 120 2023-04-15 09:18:51.170 !MESSAGE Reference to undefined variable git_work_tree !ENTRY org.eclipse.pde.core 4 0 2023-04-15 09:18:51.176 !MESSAGE The current target platform contains errors, open Window > Preferences > Plug-in Development > Target Platform for details. !STACK 1 org.eclipse.core.runtime.CoreException: Problems occurred while resolving the target contents at org.eclipse.pde.internal.core.PluginModelManager.getExternalBundles(PluginModelManager.java:696) at org.eclipse.pde.internal.core.PluginModelManager.initializeTable(PluginModelManager.java:605) at org.eclipse.pde.internal.core.PluginModelManager.targetReloaded(PluginModelManager.java:541) at org.eclipse.pde.core.target.LoadTargetDefinitionJob.resetPlatform(LoadTargetDefinitionJob.java:184) at org.eclipse.pde.core.target.LoadTargetDefinitionJob.runInWorkspace(LoadTargetDefinitionJob.java:145) at org.eclipse.jdt.ls.importer.pde.internal.PDEProjectImporter.initializeProjects(PDEProjectImporter.java:101) at org.eclipse.jdt.ls.importer.pde.internal.PDEProjectImporter.importToWorkspace(PDEProjectImporter.java:77) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.importProjects(ProjectsManager.java:148) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:111) at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:246) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Contains: Reference to undefined variable git_work_tree Contains: Reference to undefined variable git_work_tree Contains: Reference to undefined variable git_work_tree !SUBENTRY 1 org.eclipse.pde.core 4 0 2023-04-15 09:18:51.17 ```To circumvent the issue I tried
${project_loc}
and${container_loc}
variables without luck.${project_loc}
Results in:
See full log
``` ENTRY org.eclipse.jdt.ls.core 1 0 2023-04-15 09:26:25.050 !MESSAGE Finished creating the Java project jdt.ls-java-project !ENTRY org.eclipse.debug.core 4 120 2023-04-15 09:26:25.465 !MESSAGE Variable references empty selection: ${project_loc} !ENTRY org.eclipse.debug.core 4 120 2023-04-15 09:26:25.466 !MESSAGE Variable references empty selection: ${project_loc} !ENTRY org.eclipse.debug.core 4 120 2023-04-15 09:26:25.466 !MESSAGE Variable references empty selection: ${project_loc} !ENTRY org.eclipse.pde.core 4 0 2023-04-15 09:26:25.479 !MESSAGE Variable references empty selection: ${project_loc} !STACK 1 org.eclipse.core.runtime.CoreException: Variable references empty selection: ${project_loc} at org.eclipse.debug.internal.core.variables.ResourceResolver.abort(ResourceResolver.java:111) at org.eclipse.debug.internal.core.variables.ResourceResolver.getSelectedResource(ResourceResolver.java:132) at org.eclipse.debug.internal.core.variables.ResourceResolver.resolveValue(ResourceResolver.java:47) at org.eclipse.core.internal.variables.DynamicVariable.getValue(DynamicVariable.java:56) at org.eclipse.core.internal.variables.StringSubstitutionEngine.resolve(StringSubstitutionEngine.java:271) at org.eclipse.core.internal.variables.StringSubstitutionEngine.substitute(StringSubstitutionEngine.java:195) at org.eclipse.core.internal.variables.StringSubstitutionEngine.performStringSubstitution(StringSubstitutionEngine.java:91) at org.eclipse.core.internal.variables.StringVariableManager.performStringSubstitution(StringVariableManager.java:547) at org.eclipse.core.internal.variables.StringVariableManager.performStringSubstitution(StringVariableManager.java:347) at org.eclipse.pde.internal.core.target.AbstractBundleContainer.resolveVariables(AbstractBundleContainer.java:80) at org.eclipse.pde.internal.core.target.DirectoryBundleContainer.getDirectory(DirectoryBundleContainer.java:119) at org.eclipse.pde.internal.core.target.DirectoryBundleContainer.getLocation(DirectoryBundleContainer.java:61) at org.eclipse.pde.core.plugin.TargetPlatform.getLocation(TargetPlatform.java:75) at org.eclipse.pde.internal.core.EclipseHomeInitializer.resetEclipseHomeVariable(EclipseHomeInitializer.java:36) at org.eclipse.pde.core.target.LoadTargetDefinitionJob.resetPlatform(LoadTargetDefinitionJob.java:180) at org.eclipse.pde.core.target.LoadTargetDefinitionJob.runInWorkspace(LoadTargetDefinitionJob.java:145) at org.eclipse.jdt.ls.importer.pde.internal.PDEProjectImporter.initializeProjects(PDEProjectImporter.java:101) at org.eclipse.jdt.ls.importer.pde.internal.PDEProjectImporter.importToWorkspace(PDEProjectImporter.java:77) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.importProjects(ProjectsManager.java:148) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:111) at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:246) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) !SUBENTRY 1 org.eclipse.debug.core 4 120 2023-04-15 09:26:25.480 !MESSAGE Variable references empty selection: ${project_loc} !ENTRY org.eclipse.pde.core 4 0 2023-04-15 09:26:25.487 !MESSAGE The current target platform contains errors, open Window > Preferences > Plug-in Development > Target Platform for details. !STACK 1 org.eclipse.core.runtime.CoreException: Problems occurred while resolving the target contents at org.eclipse.pde.internal.core.PluginModelManager.getExternalBundles(PluginModelManager.java:696) at org.eclipse.pde.internal.core.PluginModelManager.initializeTable(PluginModelManager.java:605) at org.eclipse.pde.internal.core.PluginModelManager.targetReloaded(PluginModelManager.java:541) at org.eclipse.pde.core.target.LoadTargetDefinitionJob.resetPlatform(LoadTargetDefinitionJob.java:184) at org.eclipse.pde.core.target.LoadTargetDefinitionJob.runInWorkspace(LoadTargetDefinitionJob.java:145) at org.eclipse.jdt.ls.importer.pde.internal.PDEProjectImporter.initializeProjects(PDEProjectImporter.java:101) at org.eclipse.jdt.ls.importer.pde.internal.PDEProjectImporter.importToWorkspace(PDEProjectImporter.java:77) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.importProjects(ProjectsManager.java:148) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:111) at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:246) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Contains: Variable references empty selection: ${project_loc} Contains: Variable references empty selection: ${project_loc} Contains: Variable references empty selection: ${project_loc} !SUBENTRY 1 org.eclipse.pde.core 4 0 2023-04-15 09:26:25.487 !MESSAGE Problems occurred while resolving the target contents !SUBENTRY 2 org.eclipse.debug.core 4 120 2023-04-15 09:26:25.487 !MESSAGE Variable references empty selection: ${project_loc} !SUBENTRY 2 org.eclipse.debug.core 4 120 2023-04-15 09:26:25.487 !MESSAGE Variable references empty selection: ${project_loc} !SUBENTRY 2 org.eclipse.debug.core 4 120 2023-04-15 09:26:25.487 !MESSAGE Variable references empty selection: ${project_loc} ```${container_loc}
Results in:
See full log
``` ENTRY org.eclipse.jdt.ls.core 1 0 2023-04-15 09:30:24.965 !MESSAGE Finished creating the Java project jdt.ls-java-project !ENTRY org.eclipse.debug.core 4 120 2023-04-15 09:30:25.448 !MESSAGE Variable references empty selection: ${container_loc} !ENTRY org.eclipse.debug.core 4 120 2023-04-15 09:30:25.449 !MESSAGE Variable references empty selection: ${container_loc} !ENTRY org.eclipse.debug.core 4 120 2023-04-15 09:30:25.450 !MESSAGE Variable references empty selection: ${container_loc} !ENTRY org.eclipse.pde.core 4 0 2023-04-15 09:30:25.466 !MESSAGE Variable references empty selection: ${container_loc} !STACK 1 org.eclipse.core.runtime.CoreException: Variable references empty selection: ${container_loc} at org.eclipse.debug.internal.core.variables.ResourceResolver.abort(ResourceResolver.java:111) at org.eclipse.debug.internal.core.variables.ResourceResolver.getSelectedResource(ResourceResolver.java:132) at org.eclipse.debug.internal.core.variables.ResourceResolver.resolveValue(ResourceResolver.java:47) at org.eclipse.core.internal.variables.DynamicVariable.getValue(DynamicVariable.java:56) at org.eclipse.core.internal.variables.StringSubstitutionEngine.resolve(StringSubstitutionEngine.java:271) at org.eclipse.core.internal.variables.StringSubstitutionEngine.substitute(StringSubstitutionEngine.java:195) at org.eclipse.core.internal.variables.StringSubstitutionEngine.performStringSubstitution(StringSubstitutionEngine.java:91) at org.eclipse.core.internal.variables.StringVariableManager.performStringSubstitution(StringVariableManager.java:547) at org.eclipse.core.internal.variables.StringVariableManager.performStringSubstitution(StringVariableManager.java:347) at org.eclipse.pde.internal.core.target.AbstractBundleContainer.resolveVariables(AbstractBundleContainer.java:80) at org.eclipse.pde.internal.core.target.DirectoryBundleContainer.getDirectory(DirectoryBundleContainer.java:119) at org.eclipse.pde.internal.core.target.DirectoryBundleContainer.getLocation(DirectoryBundleContainer.java:61) at org.eclipse.pde.core.plugin.TargetPlatform.getLocation(TargetPlatform.java:75) at org.eclipse.pde.internal.core.EclipseHomeInitializer.resetEclipseHomeVariable(EclipseHomeInitializer.java:36) at org.eclipse.pde.core.target.LoadTargetDefinitionJob.resetPlatform(LoadTargetDefinitionJob.java:180) at org.eclipse.pde.core.target.LoadTargetDefinitionJob.runInWorkspace(LoadTargetDefinitionJob.java:145) at org.eclipse.jdt.ls.importer.pde.internal.PDEProjectImporter.initializeProjects(PDEProjectImporter.java:101) at org.eclipse.jdt.ls.importer.pde.internal.PDEProjectImporter.importToWorkspace(PDEProjectImporter.java:77) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.importProjects(ProjectsManager.java:148) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:111) at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:246) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) !SUBENTRY 1 org.eclipse.debug.core 4 120 2023-04-15 09:30:25.467 !MESSAGE Variable references empty selection: ${container_loc} !ENTRY org.eclipse.pde.core 4 0 2023-04-15 09:30:25.476 !MESSAGE The current target platform contains errors, open Window > Preferences > Plug-in Development > Target Platform for details. !STACK 1 org.eclipse.core.runtime.CoreException: Problems occurred while resolving the target contents at org.eclipse.pde.internal.core.PluginModelManager.getExternalBundles(PluginModelManager.java:696) at org.eclipse.pde.internal.core.PluginModelManager.initializeTable(PluginModelManager.java:605) at org.eclipse.pde.internal.core.PluginModelManager.targetReloaded(PluginModelManager.java:541) at org.eclipse.pde.core.target.LoadTargetDefinitionJob.resetPlatform(LoadTargetDefinitionJob.java:184) at org.eclipse.pde.core.target.LoadTargetDefinitionJob.runInWorkspace(LoadTargetDefinitionJob.java:145) at org.eclipse.jdt.ls.importer.pde.internal.PDEProjectImporter.initializeProjects(PDEProjectImporter.java:101) at org.eclipse.jdt.ls.importer.pde.internal.PDEProjectImporter.importToWorkspace(PDEProjectImporter.java:77) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.importProjects(ProjectsManager.java:148) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:111) at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:246) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Contains: Variable references empty selection: ${container_loc} Contains: Variable references empty selection: ${container_loc} Contains: Variable references empty selection: ${container_loc} ```What am I doing wrong? Is there a way around this?
Our workaround for now is substituting the variables with the absolute path, but this is not portable...
I opened this originally on the jdt.ls repo but was redirected here from the maintainers.