Currently the dev-java/maven-1.0_beta9 ebuild creates maven's plugins and repository directories under /usr/share/maven. However, normal users do not have write access to these directories, which means that they cannot run maven builds which require 1) expanding jars in /usr/share/maven/plugins and 2) downloading jars to /usr/share/maven/repository. Reproducible: Always Steps to Reproduce: 1. Install maven. 2. Attempt to run a maven build as a normal user. Actual Results: org.apache.maven.MavenException: Unable to extract plugin This happens because maven is trying to expand a plugin in /usr/share/maven/plugins, which a normal user does not have access to. Expected Results: This is what I did: Have the ebuild create a "maven" group. Chgrp maven /usr/share/maven/plugins and /usr/share/maven/repository, and chmod g+w these two dirs. Add an info message saying that maven users must be added to the maven group. However, this may not be the best solution.
Created attachment 14158 [details, diff] Patch for adding maven group and fix owner and permissions.
Hi Ryan, Created the patch according to your guidelines. To use, copy /usr/portage/dev-java/maven to /usr/local/portage/dev-java/maven and apply the diff. It does the following: 1) Adds/Remove group maven. 2) Sets permissions and ownership on plugin and repository directories. 3) Remove extracted plugins on unemerge. Please note that if user doesn't do a newgrp maven before running maven for the first time, the files will be created with primary group of user. Should work for normal users afterwards though as they have read access. Other than that the group doesn't really help.
if users are going to have write access to some area, it needs to be moved outside /usr. Many competant sysadmins (including myself) mount /usr as read-only for increased security. (mount it read-write as needed for maintance only).
Im finding a solution trying the user to have $HOME/.maven so he can write to that directory. As soona as i can ill post more comments on this.
I found a problem, if i set in /etc/env.d/25maven this: MAVEN_HOME=/usr/share/maven MAVEN_LOCAL_REPO=$HOME/.maven/repository MAVEN_LOCAL_REPO doesnt get SET on user enviroment, any ideas on how to set a variable for the user ?
This has been fixed in maven-1.0_beta10.ebuild also maven project fixed the bug that made this error happen, so it should be working ok with this new version.
Fixed