Using WSL with gradle build
已回答
Hi
So far I have used Linux as OS, but I will like to make it work with the Windows Subsystem for Linux.
I am using the "gradle idea" command to build my project.
I made a folder in /mnt/.. for storing my code and then I am building through the linux terminal.
When I open the project in Intellij IDEA it cannot resolve dependencies because they all refer to /home/{user}/... which Intellij cannot see as it runs in Windows.
I have also tried to open the project as a gradle project in IntelliJ, but then it fails because the build is configured to trigger some executable .sh files which cannot be triggered from Windows of course.
What will the right solution be for me?
请先登录再写评论。
> I am using the "gradle idea" command to build my project.
You should never use it, see https://stackoverflow.com/a/42518961/104891.
> What will the right solution be for me?
Run IntelliJ IDEA in WSL.
We do not support WSL paths yet on Windows:
https://youtrack.jetbrains.com/issue/IDEABKL-7908
https://youtrack.jetbrains.com/issue/IDEA-171510
Ok, I thought it wasnt possible to run idea in WSL. How can you do that?
You can Google for some guide how to add X11 support to WSL, usually you install some X Window Server on Windows host and some packages into WSL, then configure DISPLAY environment so that the GUI apps can run on your X Server.
https://virtualizationreview.com/articles/2018/01/30/hands-on-with-wsl-graphical-apps.aspx
https://askubuntu.com/a/993331/9280
Then just get IntelliJ IDEA for Linux (.tar.gz), unpack and run it in the WSL via bin/idea.sh.
We should be able to point the graddle plugin to WSLs gradle instead of local or Ideas version. Need to be able to use both the command line in WSL and the plugin to do gradle commands, but the plugin seems to default to using windows or something.
gunslingor gunslingorsadf What is your specific use case? Could you elaborate?
I dont know, ive soent the last 36 hours trying to get things working: intelllij 2022.2.1 kotlin gradle docker spring boot with some sort of live reloading. No matter what I do it doesnt work... might have to open a support ticket.
gunslingor gunslingorsadf
Yes, please do & attach screenshots of your run configurations and the idea.log file after restarting the IDE and reproducing the problem. Help | Show Log in...
Started support request, uploaded my project template: https://intellij-support.jetbrains.com/hc/en-us/requests/4273740