File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed
plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler Expand file tree Collapse file tree 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 {
268268
269269 protected void logCompiling (String [] sourceFiles , CompilerConfiguration config ) {
270270 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 ();
277271 log .info ("Compiling "
278272 + (sourceFiles == null
279273 ? ""
280274 : (sourceFiles .length + " source file" + (sourceFiles .length == 1 ? " " : "s " )))
281275 + "with "
282276 + getCompilerId () + " [" + config .describe () + "]" + " to "
283- + to );
277+ + getRelativeWorkingDirectory ( config ) );
284278 }
285279 }
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+ }
286298}
You can’t perform that action at this time.
0 commit comments