Open zachradtka opened 1 year ago
Probably some issue with how permissions work on WSL2, I bet if you chmod 777 ~/.m2
before running docker it works
Thanks for the prompt reply.
I tried changing permissions and still the same error. Here is my m2 directory with 777.
$ ls -lad ~/.m2
drwxrwxrwx 3 zach zach 4096 Feb 13 17:04 /home/zach/.m2
Here is the same error as before.
$ docker run -v ~/.m2:/var/maven/.m2 -it --rm -u $(id -u) -e MAVEN_CONFIG=/var/maven/.m2 maven mvn -e -Duser.home=/var/maven archetype:generate
mkdir: cannot create directory ‘/var/maven/.m2/repository’: Permission denied
Can not write to /var/maven/.m2/copy_reference_file.log. Wrong volume permissions? Carrying on ...
[INFO] Error stacktraces are turned on.
[ERROR] Could not create local repository at /var/maven/.m2/repository -> [Help 1]
org.apache.maven.repository.LocalRepositoryNotAccessibleException: Could not create local repository at /var/maven/.m2/repository
at org.apache.maven.DefaultMaven.validateLocalRepository (DefaultMaven.java:385)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:169)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LocalRepositoryNotAccessibleException
I am not entirely sure, but I feel like it's a permission problem within the container.
Similar close issues re #86 and #83 .
My docker command is copied directly from the example:
The output is:
My
~/.m2
directory is owned by my user:I am running Ubuntu on WSL2.
Please let me know if there is anymore information that might be helpful.