Invoke the "which mvn" using the default shell in the distro to enable finding Maven installed through SDKMAN

GitOrigin-RevId: 99cda5f31a08634b0c39b2a849cda3deaf9e5844
This commit is contained in:
Carlos Rafael Ramirez
2021-03-09 10:23:37 +00:00
committed by intellij-monorepo-bot
parent 8bb693d143
commit 28c64f0c60
@@ -107,7 +107,11 @@ object MavenWslUtil : MavenUtil() {
MavenLog.LOG.debug("Maven home found at /usr/share/maven2")
return home
}
val processOutput = this.executeOnWsl(listOf("which", "mvn"), WSLCommandLineOptions().setExecuteCommandInLoginShell(true), 10000, null)
val options = WSLCommandLineOptions()
.setExecuteCommandInLoginShell(true)
.setShellPath(this.shellPath)
val processOutput = this.executeOnWsl(listOf("which", "mvn"), options, 10000, null)
if (processOutput.exitCode == 0) {
val path = processOutput.stdout.lines().find { it.isNotEmpty() }?.let(this::resolveSymlink)?.let(this::getWindowsPath)?.let(::File)
if (path != null) {
@@ -172,4 +176,4 @@ object MavenWslUtil : MavenUtil() {
val jdkWslDistr = tryGetWslDistributionForPath(ProjectRootManager.getInstance(project).projectSdk?.homePath) ?: return false
return jdkWslDistr.id == projectWslDistr.id
}
}
}