Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows 10 WSL - Maven config

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

like image 344
vitorvr Avatar asked Jun 26 '19 02:06

vitorvr


People also ask

How do I set WSL2 as default?

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.

Where does WSL2 install to?

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.


1 Answers

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.

like image 68
vitorvr Avatar answered Oct 11 '22 10:10

vitorvr