5

Got the following weird exception, any one can help ? Thanks

[info] Compiling 3 Java sources to /mnt/nfs0/jzhang/spark-1.6.1/tags/target/scala-2.10/classes...
[error] /mnt/nfs0/jzhang/spark-1.6.1/tags/src/main/java/org/apache/spark/tags/DockerTest.java:26: error: error while writing DockerTest: could not create parent directories
[error] public @interface DockerTest { }
[error]         ^
[error] 1 error
[error] Compile failed at Mar 8, 2016 11:17:18 AM [0.817s]
zjffdu
  • 25,496
  • 45
  • 109
  • 159
  • Do you have write permissions on the classes directory? See: http://stackoverflow.com/questions/12514867/cannot-compile-wordcount-java – riddle_me_this Mar 08 '16 at 13:33
  • Yes, I have. The only special thing here is that it is on mounted directory. – zjffdu Mar 09 '16 at 00:34
  • @zjffdu Were you able to resolve this issue? If so, can you please share more details? Thanks. – Ravi Oct 12 '20 at 23:09

5 Answers5

7

I also faced this is issue.. It occurs mainly due to two reasons:

  1. Permission Problem: some folder doesn't have write permission in the project. Try to change the permission of those folders.
  2. While importing the code from any repository, their might chances of file may get ^M characters at end of line. For this use "dos2unix" command. (I faced same problem due to this, as all my java files were containing this character.)
Atmaram
  • 152
  • 3
  • 11
  • checked out the same code again in a different folder and it worked. – Smart Coder Mar 15 '22 at 13:53
  • This was a linebreak issue for me. It seems one of the files had a windows linebreak from when the project was created from a maven template. Since I was using editorconfig to specify linux linebreaks, all I had to do was open the file mentioned in the exception in my IDE and re-save it. – Jordan Morris Feb 03 '23 at 05:41
1

My issue is resolved after restarting the eclipse.

0

For me I think I was out of disk space. Hoovering up some files with sudo journalctl --vacuum-size=500M seems to have fixed it.

JL_SO
  • 1,742
  • 1
  • 25
  • 38
0

From August 2022, I was getting this error on everything I tried, all java maven projects. For me simply upgrading from Maven 3.6.3 -> Maven 3.8.6 solved the issue.

0

May be caused by a file lock, e.g. if you previously built it in your IDE and the IDE is still open.

Jordan Morris
  • 2,101
  • 2
  • 24
  • 41