Skip to content

Commit 5fe7740

Browse files
committed
Fix annotation of test-scope plugins with Java 9+
The build-time hack using EclipseHelper to index SciJava Common's plugins was running only in conjunction with main class compilation, not test class compilation. The reason SciJava Common's test classes still got their plugins indexed is because there is an additional invocation of EclipseHelper at runtime when tests are executed -- which works as long as the runtime class loader is a URLClassLoader. But in Java 9+, the runtime class loader is not a URLClassLoader anymore, so this late-stage runtime indexing of test-scoped plugins does not occur. The result: when building with Java 9+, a bunch of the tests were failing due to unindexed plugins in src/test/java. The fix: run the EclipseHelper again during process-test-classes, which is the proper phase for doing postprocessing to test classes. This change lets Java 9+ compile SciJava Common with passing tests.
1 parent 2c3ab68 commit 5fe7740

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,22 @@
223223
<artifactId>exec-maven-plugin</artifactId>
224224
<executions>
225225
<execution>
226+
<id>index-annotations</id>
226227
<phase>process-classes</phase>
227228
<goals>
228229
<goal>java</goal>
229230
</goals>
230231
</execution>
232+
<execution>
233+
<id>index-test-annotations</id>
234+
<phase>process-test-classes</phase>
235+
<goals>
236+
<goal>java</goal>
237+
</goals>
238+
<configuration>
239+
<classpathScope>test</classpathScope>
240+
</configuration>
241+
</execution>
231242
</executions>
232243
<configuration>
233244
<mainClass>org.scijava.annotations.EclipseHelper</mainClass>

0 commit comments

Comments
 (0)