Skip to content

Windows: Compilation fails if source and build directories are on different drives #364

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
ogrovlen opened this issue Feb 5, 2024 · 0 comments

Comments

@ogrovlen
Copy link

ogrovlen commented Feb 5, 2024

If the build directory is on a different drive than the source directory, compilation fails with the following call stack:

  Caused by: java.lang.IllegalArgumentException: 'other' has different root
      at sun.nio.fs.WindowsPath.relativize (WindowsPath.java:420)
      at sun.nio.fs.WindowsPath.relativize (WindowsPath.java:42)
      at org.codehaus.plexus.compiler.AbstractCompiler.logCompiling (AbstractCompiler.java:286)
      at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile (JavacCompiler.java:150)
      at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1140)
      at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:193)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
      at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
      ...

The problem seems to be that org.codehaus.plexus.compiler.AbstractCompiler.logCompiling calls relativize with a path from a different drive.

The workaround is to use Maven's -q option since the offending call is skipped if Info logging is not enabled. However, it would be nice if this could work also for "non-quiet" builds.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant