Community
Participate
Working Groups
Steps to reproduce: 1. start Eclipse with a relative workspace location, e.g. "../ws" 2. import a project with a target file 3. open the target file 4. click on "Set as Target Platform" -> so far this works as expected 5. switch to a different workspace, e.g. "../ws2" 6. import the same project as in 2 7. open the same target file as in 3 8. click on "Set as Target Platform" -> This results in an error of the following form Problems occurred getting the plug-ins in this container An error occurred while collecting items to be installed session context was:(profile=TARGET_DEFINITION:resource:/<your-project-here>/<your-target-file-name-here>.target, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=). Artifact org.eclipse.update.feature,<some-id>,<some-version> is a folder but the repository is an archive or remote location. Artifact org.eclipse.update.feature,<next-id>,<next-version> is a folder but the repository is an archive or remote location. ...
For tracing this problem, place breakpoints in the following locations before step 6: a) entry of org.eclipse.pde.internal.core.target.P2TargetUtils.findWorkspaceRepos(Set) b) second line (after isFolderBased check) of org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.downloadArtifact(IArtifactDescriptor, OutputStream, IProgressMonitor) When hitting breakpoint a, make sure that @recent@ contains the relative path to the workspace location of step 1 so that @new File(bundlePool).exists()@ passes. This works out of the box in normal installations - if Eclipse is started as PDE run configuration, the @recent@ variable needs to be changed with the debugger. When hitting breakpoint b, step into getArtifactFile, getLocation and see how the mapper does something different with the invalid, opaque file URI as the rest of the broken p2 URI handling. You may claim that this is a p2 bug, but IMHO the whole URI handling in p2 is broken beyond repair. (feel free to open a bug report on p2, but I won't.) Therefore, I would say that this is a PDE bug: org.eclipse.pde.internal.core.target.P2TargetUtils.findWorkspaceRepos(Set) should only produce valid file URIs (as defined by java.io.File) in the first place and just not run into this p2 trap.
Created attachment 207034 [details] Fix: Add recent workspace bundle pools as absolute URIs
Applied the patch to HEAD. It is an edge case, but the provided code is a better way to create the URIs. Thanks.