Skip to content

Commit

Permalink
Prevent initial build-path errors on new external-folders in container
Browse files Browse the repository at this point in the history
When adding an external-folder ('library-folder') to a
classpath-container for the first time the initial build (without a
rebuild, e.g. through auto-build) leads to a build-path (validation)
error.
This happens for example when adding to a MANIFEST.MF a new requirement
on a bundle that's a directory and not a jar and the PDE
'required-Plugins' classpath container is updated.
  • Loading branch information
HannesWell committed Feb 12, 2025
1 parent 668fa97 commit 31f004b
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -50,10 +50,6 @@ protected void classpathChanged(ClasspathChange change, boolean refreshExternalF
project.resetCaches();

if (this.canChangeResources) {
// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=177922
if (isTopLevelOperation() && !ResourcesPlugin.getWorkspace().isTreeLocked()) {
new ClasspathValidation(project).validate();
}

// delta, indexing and classpath markers are going to be created by the delta processor
// while handling the resource change (either .classpath change, or project touched)
Expand All @@ -62,6 +58,11 @@ protected void classpathChanged(ClasspathChange change, boolean refreshExternalF
// and ensure that external folders are updated as well
new ExternalFolderChange(project, change.oldResolvedClasspath).updateExternalFoldersIfNecessary(refreshExternalFolder, null);

// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=177922
if (isTopLevelOperation() && !ResourcesPlugin.getWorkspace().isTreeLocked()) {
new ClasspathValidation(project).validate();
}

} else {
DeltaProcessingState state = JavaModelManager.getDeltaState();
JavaElementDelta delta = new JavaElementDelta(getJavaModel());
Expand Down

0 comments on commit 31f004b

Please sign in to comment.