Maven stops working from terminal after macOS Catalina update: there is no POM in this directory

Viewed 4142

After updating to Catalina I get the following error when running mvn clean install from the terminal:

 The goal you specified requires a project to execute but there is no POM in this directory (/private/var/folders/xs/lgy9yxv501xcvnqr_zhg85wr0000gn/T/hsperfdata_user1). Please verify you invoked Maven from the correct directory.

The current directory contains a pom.xml and a valid project

user1@xyz project1 % pwd
/Users/user1/Documents/project/project1
user1@xyz project1 % ls
README.md            pom.xml                project1-service   

I've tried mvn clean install -f pom.xml as well. This will error with:

The project  (/Users/user1/Documents/project/project1/pom.xml) has 1 error
[ERROR]     Non-readable POM /Users/user1/Documents/project/project1/pom.xml: /Users/user1/Documents/project/project1/pom.xml (Operation not permitted) 

This works just fine from InteliJ's terminal. Any idea what happened?

3 Answers

What I ended up doing was to System Preferences->Security & Privacy->Full Disk Access and add Terminal there. Apparently with Catalina you have to manually grant access to apps that access user files.

I had the same problem, but the cause of it was different. My maven was installed outside of usual directories under /apps/. The system upgrade wiped everything it didn't see appropriate. All custom directories were simply gone. Maven had to be re-installed using brew install maven.

UPDATE:

The files haven't been deleted. Instead, they've been relocated to /Users/Shared/Previously Relocated Items, which prevents executables from being found, but the files are not completely lost. You can take what you need from that folder, but in case of maven you can just delete it and install anew using brew with my instruction above.

Here's the explanation for why Catalina has done it: https://www.macrumors.com/guide/relocated-items/

for Mac users: you need to make sure to do this so it builds the right directory: mvn -f path/to/pom.xml ... and then give the access to files and folders to java and terminal from the security&privacy option in system preferences

Related