0

I have a Spring Boot project which passes all it's tests under the mvn clean install command in Windows 10. The same exact code base, against the same database, has some test case failures when executing mvn clean install in Ubuntu 16.04. I traced the problem to a directory not being created by the code inside a failing test case using the mkdirs() function. I don't know why, I mean, I own the project so I wouldn't think it's a permissions issue. I cloned the project in Ubuntu from the remote repository using Intellij IDEA's built in Git functionality. Many of the other test cases (hundreds of them) are passing but a few fail and they are all related to this mkdirs() issue. Just to reiterate, the problem only exists in Ubuntu 16.04, not in Windows 10 where all tests pass. If more information is needed please let me know I'll provide.

Is there any way to resolve it without altering the code?

Anonymous Human
  • 1,858
  • 1
  • 21
  • 47
  • Ubuntu has very strict permissions as compared to windows . I suggest checking the permissions on the parent directory where mkdirs() is getting executed. – vvs Jan 11 '17 at 17:17
  • Replace mkdirs with Files.createDirectories(). http://stackoverflow.com/a/12204054/3458 –  Jan 11 '17 at 17:21
  • @vvs drwxrwxr-x are the perms. on the parent and also it's parent. I did try to make the last triplet rwx on the parent but that didn't help. – Anonymous Human Jan 11 '17 at 17:35
  • @Arkadiy that gives me a `java.nio.file.AccessDeniedException`. – Anonymous Human Jan 11 '17 at 19:56
  • @AnonymousHuman: this is more than just "false", right? Please add the exception (with the stack trace) to the question, and we'll all have more information. –  Jan 11 '17 at 21:28
  • @AnonymousHuman looking at your reply I figure you have found the directory where code gets "executed". This may not be same as the directory where code resides. Also as a practise do not open permissions to all. Usually rwxr-xr-- should suffice if you are running code as directory owner – vvs Jan 12 '17 at 00:44

1 Answers1

0

I found that the issue was a root directory setting being set in a configuration file of the code base. While that root directory would be openly accessible on a Windows platform, on Ubuntu it was restricted. Changing the setting in the configuration file to point to a base directory where I know I had write permission solved the issue.

Anonymous Human
  • 1,858
  • 1
  • 21
  • 47