LocalRepositoryNotAccessible error when running maven

On running mvn jetty:run
I get the error LocalRepositoryNotAccessible
I am running this command as a different user snippet which is also a group with nologin
like daemon --user=snippet "mvn jetty:run"
Now all my directories under /root/.m2 i have added them to group snippet
and snippet group contains user snippet and root.
So my .m2 directories and all files under it are having proper permissions.

Th error i get is : Could not create local repository at /root/.m2/repository.
Thats strange because the repo is already there and my user snippet has permission to access it.

I have modified the settings.xml also to take the local repo always from /root/.m2/repository

Don’t know whats going wrong which is causing this error ?

Rohit BajajAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Does the group have write access to all files and directories?  It might even need write access to /root, if it blindly tries to create the .m2 directory even though it is already there.

I still think you would be better off copying the entire tree to /home/snippet and making user snippet own them.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.