Closed shambalaxx closed 8 years ago
Like mentioned in the installation guide you have to load gvm in the powershell session. You could do this by adding Import-Module posh-gvm
to your profile. I didn't automate this because I didn't like a script to modify my profile. Probably this could be changed so that the installation prompts the user.
When you enter gvm
without loading the module, powershell doesn't know the command and checks if there is a module available which could provide it and then loads the posh-gvm module.
posh-gvm manages the SDKs for your powershell environment and not for CMD. There is no CMD implementation (as best as I know). But you could add gradle to your global path variable (eg the current symlink).
If you start CMD within the powershell session (type cmd
) than the started cmd would work with the same PATH as powershell and therefore it would also work in CMD.
Thanks for comprehensive answer.
But why we can't just update the global path variable in installation script?
Do you mean why do we not change always the global var? If yes, because:
You are using CMD in general and you only start the PowerShell for posh-gvm? Or why do you need CMD to know which the gradle path?
I don't use powershell most of the time because it cmd is just faster. At least first loading of powershell is very slow.
I didn't know the point that updating global PATH variable could be that slow. For me 'setx' command works pretty fast. But requires restart of any application that we want to use the new value.
Last time I tested the needed .net method [environment]::SetEnvironmentVariable('PATH', xy, 'Machine')
(probably 'User' would be enough) took sometimes several seconds. But this was years ago.
I will not change the default behavior. You could provide a pull request which will set it globally if especially configurated. But most likely the easiest solution for you would be to change the global path once manually. If you add something like <userhome>/.posh_gvm/gradle/current
to your PATH, it should be working for your use case for now.
Yes, workaround works fine for me. Thank you.
After first run of powershell system cannot find any installed software for example:
PS C:\Users\username> gradle -v gradle : The term 'gradle' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
So to make gradle command available we have to run 'gvm c' first.
And there is noway to call gradle from 'cmd'.