Commit 35ca6b0
committed
Fix annotation processing when running javac without -d <directory>
Samuel Inverso noticed, and Mark Hiner diagnosed, that compiling SciJava
plugins using javac without specifying an output directory will write the
annotation index into an incorrect location (instead of META-INF/json/ it
is written into the top-level directory).
This can be verified using a very simple example x1.java file:
-- snip --
import org.scijava.plugin.Plugin;
import org.scijava.plugin.SciJavaPlugin;
@plugin(type = SciJavaPlugin.class)
public class x1 implements SciJavaPlugin { }
-- snap --
The reason is that javac's DefaultFileManager will strip out any
subdirectory in the path passed to the createResource() method unless
an output directory is specified.
Work around that by detecting the situation and creating the subdirectory
explicitly.
This fixes imagej/imagej-launcher#22.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>1 parent 8e11e2e commit 35ca6b0
File tree
1 file changed
+24
-4
lines changed- src/main/java/org/scijava/annotations
1 file changed
+24
-4
lines changedLines changed: 24 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| 67 | + | |
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
| |||
234 | 237 | | |
235 | 238 | | |
236 | 239 | | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
241 | 261 | | |
242 | 262 | | |
243 | 263 | | |
| |||
0 commit comments