Skip to content

Commit ed31e0b

Browse files
committed
Explicitly refresh and rebuild test project after .classpath change
This hopefully fixes spurious test failures, like this one: ProjectPropertiesModelTest.testProjectClasspath:584 Found these URIs: [file:/usr/lib/jvm/temurin-21-jdk-amd64/lib/jrt-fs.jar, file:/home/runner/work/pmd-eclipse-plugin/pmd-eclipse-plugin/net.sourceforge.pmd.eclipse.plugin.test/target/work/data/ProjectPropertiesModelTest/bin/] expected: 6 but was: 2
1 parent 8291b46 commit ed31e0b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

net.sourceforge.pmd.eclipse.plugin.test/src/main/java/net/sourceforge/pmd/eclipse/runtime/properties/ProjectPropertiesModelTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,11 @@ public void testProjectClasspath() throws Exception {
573573
+ " <classpathentry kind=\"lib\" path=\"/ExternalProject/sample-lib4.jar\"/>\n"
574574
+ "</classpath>\n";
575575
file.setContents(IOUtils.toInputStream(newClasspathContent, "UTF-8"), 0, null);
576+
// refresh, so that changed .classpath file is considered
577+
this.testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
578+
// rebuild again, so that changed classpath is configured on java project
579+
this.testProject.build(IncrementalProjectBuilder.FULL_BUILD, null);
580+
576581
final IProjectPropertiesManager mgr = PMDPlugin.getDefault().getPropertiesManager();
577582
IProjectProperties model = mgr.loadProjectProperties(this.testProject);
578583
URLClassLoader auxClasspath = (URLClassLoader) model.getAuxClasspath(); // NOPMD: don't close auxclasspath in test, this should be done by the plugin

0 commit comments

Comments
 (0)