Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 997
Roxana Roman Avatar asked Oct 21 '19 08:10

Roxana Roman


People also ask

Why mvn command is not working in Mac?

If you get mvn command not found when you run a maven command on macOS or any bash terminal then you have not set the PATH for maven home. Note that it is better to set the path details in the ~/. zshrc file to make it permanent.

How to check Maven version in mac?

Once Maven is installed, you can check the version by running mvn -v from the command-line.


2 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.

like image 87
Roxana Roman Avatar answered Nov 15 '22 09:11

Roxana Roman


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/

like image 37
ATrubka Avatar answered Nov 15 '22 07:11

ATrubka