File tree 1 file changed +19
-7
lines changed
plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler
1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -268,19 +268,31 @@ private static String getCanonicalPath(File origFile) throws CompilerException {
268
268
269
269
protected void logCompiling (String [] sourceFiles , CompilerConfiguration config ) {
270
270
if (log .isInfoEnabled ()) {
271
- String to = (config .getWorkingDirectory () == null )
272
- ? config .getOutputLocation ()
273
- : config .getWorkingDirectory ()
274
- .toPath ()
275
- .relativize (new File (config .getOutputLocation ()).toPath ())
276
- .toString ();
277
271
log .info ("Compiling "
278
272
+ (sourceFiles == null
279
273
? ""
280
274
: (sourceFiles .length + " source file" + (sourceFiles .length == 1 ? " " : "s " )))
281
275
+ "with "
282
276
+ getCompilerId () + " [" + config .describe () + "]" + " to "
283
- + to );
277
+ + getRelativeWorkingDirectory ( config ) );
284
278
}
285
279
}
280
+
281
+ private static String getRelativeWorkingDirectory (CompilerConfiguration config ) {
282
+ String to ;
283
+ if (config .getWorkingDirectory () == null ) {
284
+ to = config .getOutputLocation ();
285
+ } else {
286
+ try {
287
+ to = config .getWorkingDirectory ()
288
+ .toPath ()
289
+ .relativize (new File (config .getOutputLocation ()).toPath ())
290
+ .toString ();
291
+ } catch (IllegalArgumentException e ) {
292
+ // may happen on Windows if the working directory is on a different drive
293
+ to = config .getOutputLocation ();
294
+ }
295
+ }
296
+ return to ;
297
+ }
286
298
}
You can’t perform that action at this time.
0 commit comments