Is there a way to configure Windows Maven and WSL Maven to use the same .m2/repository
and settings.xml
?
In my .bashrc
from WSL I added the M2_HOME
to use the same installation that Windows 10 use:
.bashrc:
export M2_HOME=/mnt/c/development/maven
Windows PATH:
C:\development\maven
But when I execute mvn clean install
on Windows Bash, a .m2 folder is created in ~/.m2 (WSL folder system).
To set the default version to WSL 1 or WSL 2 when a new Linux distribution is installed, use the command: wsl --set-default-version <Version#> , replacing <Version#> with either 1 or 2.
Since most WSL Linux distributions will be installed from the Microsoft store, you can look for the Linux file system in the same place as other Windows store apps. Navigate to %USERPROFILE%\AppData\Local\Packages\ to find the directory where your Windows store apps go.
Found a possible solution.
I created a symbolic link from ~/.m2
to /mnt/c/Users/<username/.m2
Command: $ ln -s /mnt/c/Users/<username>/.m2 ~/.m2
Until the moment is working fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With