Pitfalls of iCloud File Management#
Created: June 4, 2021 12:08 PM
Tags: Maven, iCloud, Troubleshooting
Today I encountered a pitfall caused by iCloud, which I couldn't find on Google. I'll make a note of it so I don't forget...
It's been a long time since I wrote Java SDK. Today, I needed to add a field to generate a new SDK for a temporary task. This required upgrading the version number of the service managed in Maven. Since there are multiple instances in the project, I used the mvn command to upgrade.
mvn versions:set -DnewVersion={Version.No}-SNAPSHOT
Then mvn started throwing an error.
mvn versions:set -DnewVersion=1.1.3-SNAPSHOT
java.io.FileNotFoundException: /Users/xxx/Documents/Java/apache-maven-3.6.0/bin/m2.conf (No such file or directory)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:390)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
I cd into the directory and did an ls, and indeed it wasn't there.
Strange, I searched for the error and all the suggestions were to reconfigure the Maven path. So I checked zshrc, and the configuration was correct. I was stuck...
I thought about it and decided to just copy the file from the complete installation package.
As a result, when I used Alfred to search, it directly opened the bin directory of Maven, and there was the m2.conf file.
I returned to the terminal and did an ls, but it was still the same.
So, I did an ls -a to see hidden files, and sure enough, there was a file named .m2.conf.icloud.
This file exists in Finder but is actually uploaded to iCloud and doesn't exist locally, so it needs to be opened with software to download.
After executing the mvn command again, everything worked~~
Lesson learned: don't put these development files and directories in iCloud. The impact of cloud synchronization on files is unknown and very troublesome.
Above