gradle version manager tool for windows like pik for ruby - gradle

Like pik which provides the facility to switch between ruby versions on the fly from command prompt, is there any tool which provides the same kind of behavior for gradle, so that i can switch to gradle version I'm using based on need.
I googled it, but couldn't find proper solution. So posting here.
Below error I'm getting when use sdkman windows version:
PS C:\Users\user> Import-Module posh-gvm
This command is not available in offline mode.
At C:\Users\user\Documents\WindowsPowerShell\Modules\posh-gvm\Utils.ps1:294 char:14
+ throw <<<< 'This command is not available in offline mode.'
+ CategoryInfo : OperationStopped: (This command is...n offline mode.:String) [], RuntimeException
+ FullyQualifiedErrorId : This command is not available in offline mode.
Import-Module : The specified module 'posh-gvm' was not loaded because no valid module file was found in any module dir
ectory.
At line:1 char:14
+ Import-Module <<<< posh-gvm
+ CategoryInfo : ResourceUnavailable: (posh-gvm:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Yes, there's such tool. It's called sdkman. You can easily switch between versions of gradle, groovy and other available frameworks, languages.

Related

Cannot install Chocolatey on Windows 10 version 1903

I recently upgraded my Windows 10 to version 1903, but after some issue and contacting Microsoft technical support, I've reset my Windows. Now I'm trying to reinstall everything that was installed before reset and one of them is Chocolatey (The package manager for Windows).
I tried running both installation command:
(for cmd)
#"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
(for PowerShell)
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
but every time I get this error:
Exception calling "Start" with "0" argument(s): "The specified executable is not a valid application for this OS
platform."
At C:\Users\ehsan\Downloads\install.ps1:206 char:3
+ $process.Start() | Out-Null
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : Win32Exception
Exception calling "BeginOutputReadLine" with "0" argument(s): "StandardOut has not been redirected or the process
hasn't started yet."
At C:\Users\ehsan\Downloads\install.ps1:207 char:3
+ $process.BeginOutputReadLine()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
Exception calling "WaitForExit" with "0" argument(s): "No process is associated with this object."
At C:\Users\ehsan\Downloads\install.ps1:208 char:3
+ $process.WaitForExit()
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
Unable to unzip package using 7zip. Perhaps try setting $env:chocolateyUseWindowsCompression = 'true' and call install
again. Error: 7-Zip signalled an unknown error (code )
At C:\Users\ehsan\Downloads\install.ps1:220 char:15
+ ... default { throw "$errorMessage 7-Zip signalled an unknown error (co ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Unable to unzip...n error (code ):String) [], RuntimeException
+ FullyQualifiedErrorId : Unable to unzip package using 7zip. Perhaps try setting $env:chocolateyUseWindowsCompres
sion = 'true' and call install again. Error: 7-Zip signalled an unknown error (code )
I also tried downloading the install.ps1 scripts and running it manually (after setting execution policy to bypass, for sure), but the result was the same as above. Worth mentioning that I ran both cmd and PowerShell as administrator for installation. By the way, I didn't try offline installation yet, because I cannot figure out what the instruction says.
Googling the error didn't help me find a solution.
I had this same problem (at least the message was exactly the same). I was installing chocolatey in a more controlled environment, that is, some parts of the scripts are not allowed to be performed by some security policy reason.
The error is that on line 192 of the PowerShell, it's attempted to download an EXE file:
Download-File 'https://chocolatey.org/7za.exe' "$7zaExe"
This is not allowed in my environment, so as I have the Zip already installed on my Windows, I just copy the and renamed the needed file (7az.exe) to the folder that the install.ps1 (Powershell script) was looking for.
In my case:
C:\Users\%USER%\AppData\Local\Temp\chocolatey\chocInstall\7za.exe
So, having the ZIP exe file at this path, with this name, everything worked.
Cheers

Cassandra installation on Windows 7

I have done the following on Windows 7 for running Cassandra:
Installed Python.
Downloaded a zip of Cassandra from the original site.
While executing cassandra batch getting following messages:
Exception calling "Start" with "0" argument(s): "The system cannot find the file
specified" At E:\apache-cassandra-3.11.2\conf\cassandra-env.ps1:212 char:5
+ $p.Start() | Out-Null
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : Win32Exception
You may want to check out https://kimola.com/cassandrows. I am in the same situation of wanting to install Cassandra on Windows. But I do not want to be left behind with version 3.9.0.

SCOM 2016 PowerShell

I'm trying to package SCOM Console 2016 using Thinapp 5.2. The customer wants to use the PowerShell part of SCOM as well. But whenever i start SCOM Shell, it gives me a bunch of errors telling me that it can't find certain .dll files and more.
I have already tried installing it on a VM before but it gives me the same error messages, so Thinapp is not causing the errors.
Does anyone know where i should look?
Import-Module : Cannot load Windows PowerShell snap-in C:\Program Files (x86)\System Center Operations Manager 2016\Powershell\OperationsManager\OM10.CoreCommands\Microsoft.EnterpriseManagement.Core.Cmdlets.dll because of the following error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Loader Exceptions:
Could not load file or assembly Microsoft.EnterpriseManagement.Core, Version=7.0.5000.
, Culture=neutral, PublicKeyToken=31bf3856ad364e35 or one of its dependencies.
The system cannot find the file specified.
At C:\Program Files (x86)\System Center Operations Manager 2016\Powershell\OperationsManager\OperationsManager.psm1:1261 char:14
+ Import-Module <<<< $psScriptRoot\OM10.CoreCommands\OM10.CoreCommands.psd1
+ CategoryInfo : ResourceUnavailable: (:) [Import-Module], PSSnapInException
+ FullyQualifiedErrorId : PSSnapInLoadFailure,Microsoft.PowerShell.Commands.ImportModuleCommand
Import-Module : Could not load file or assembly file:///C:\Program Files (x86)\Systemcenter Operations Manager 2016\Powershell\OperationsManager\OM10.Commands\Microsoft.SystemCenter.OperationsManagerV10.Commands.dll or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded
At C:\Program Files (x86)\System Center Operations Manager 2016\Powershell\OperationsManager\OperationsManager.psm1:1262 char:14
+ Import-Module <<<< $psScriptRoot\OM10.Commands\OM10.Commands.psd1
+ CategoryInfo : NotSpecified: (:) [Import-Module], BadImageFormatException
+ FullyQualifiedErrorId : System.BadImageFormatException,Microsoft.PowerShell.Commands.ImportModuleCommand
Add-Type : Could not load file or assembly file:///C:\Program Files (x86)\System Center Operations Manager 2016\Console\Microsoft.Mom.Common.dll or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded
At C:\Program Files (x86)\System Center Operations Manager 2016\Powershell\OperationsManager\OperationsManager.psm1:1311 char:15
+ Add-Type <<<< -Path $consoleMomCommon
+ CategoryInfo : NotSpecified: (:) [Add-Type], BadImageFormatException
+ FullyQualifiedErrorId : System.BadImageFormatException,Microsoft.PowerShell.Commands.AddTypeCommand
Problem solved, it turned out we were using an old version of Windows Management Framework. After updating to version 5.1 all the errors were gone. I installed this update: KB3191566

Error while loading Oracle.DataAccess.dll

I am getting error while executing below command in powershell.
[Reflection.Assembly]::LoadFile("C:\Oracle\Oracle11gClientR1\ODP.NET\bin\2.x\Oracle.DataAccess.dll")
This is the error.
Exception calling "LoadFile" with "1" argument(s): " is not a valid Win32 application. (Exception from HRESULT: 0x80070
0C1)"
At line:1 char:32
+ [Reflection.Assembly]::LoadFile <<<< ("C:\Oracle\Oracle11gClientR1\ODP.NET\bin\2.x\Oracle.DataAccess.dll")
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Can anybody advise me what am i doing wrong?
I checked this path (
C:\Oracle\Oracle11gClientR1\ODP.NET\bin\2.x\Oracle.DataAccess.dll
) and it is correct.
Update:
Powershell version is 2.
And i tried these as well
Add-Type -AssemblyName "c:\Oracle\Oracle11gClientR1\ODP.NET\bin\2.x\Oracle.DataAccess.dll"
Add-Type "c:\Oracle\Oracle11gClientR1\ODP.NET\bin\2.x\Oracle.DataAccess.dll"
But no luck.
In that case, most probably you are running PowerShell version 2.0 with .NET Framework version 4.0 which is incompatible. Try using a compatible .NET Framework version. To check
Powershell version run the command
$PSVersionTable.psversion
To check .NET framework version installed run below command and check the 2nd line 3rd column data
gci "hklm:\SOFTWARE\Microsoft\NET Framework Setup\NDP"
EDIT:
Few more suggestions:
Try using LoadFrom() instead like
[Reflection.Assembly]::Assembly.LoadFrom("c:\Oracle\Oracle11gClientR1\ODP.NET\bin\2.x\Oracle.DataAccess.dll");
(OR) Try using Add-Type instead like
Add-Type -AssemblyName "c:\Oracle\Oracle11gClientR1\ODP.NET\bin\2.x\Oracle.DataAccess.dll"
Also, make sure that you are not trying load 32-bit Oracle.DataAccess.dll from 64-bit Windows Powershell. I mean they both should be compaitible.

How do I Enable Migrations in the Package Manager Console?

I'm trying to enable migrations in MVC4, Entity Framework 5.00, however when I input the command it throws the following error:
Cannot determine a valid start-up project. Using project 'EFMigrations' instead. Your configuration file and working directory may not be set as expected. Use the -StartUpProjectName parameter to set one explicitly. Use the -Verbose switch for more information.
Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file://\\s01\data\Documents\Visual Studio 2010\Projects\EFMigrations\packages\EntityFramework.5.0.0\tool
s\EntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
At \\s01\data\Documents\Visual Studio 2010\Projects\EFMigrations\packages\EntityFramework.6.0.0-beta1\tools\EntityFramework.psm1:669 char:62
+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $ToolsPath EntityFramework.PowerShell.Utility.dll))
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
You cannot call a method on a null-valued expression.
At \\s01\data\Documents\Visual Studio 2010\Projects\EFMigrations\packages\EntityFramework.6.0.0-beta1\tools\EntityFramework.psm1:670 char:50
+ $dispatcher = $utilityAssembly.CreateInstance <<<< (
+ CategoryInfo : InvalidOperation: (CreateInstance:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'file://\\s01\data\Documents\Visual Studio 2010\Projects\EFMigrations\packages\EntityFramework.
5.0.0\tools\EntityFramework.PowerShell.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
At \\s01\data\Documents\Visual Studio 2010\Projects\EFMigrations\packages\EntityFramework.6.0.0-beta1\tools\EntityFramework.psm1:698 char:31
+ $domain.CreateInstanceFrom <<<< (
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
any and all help would be appreciated.
Running migrations from a network path is unsupported.
EF Team Triage: The migrations commands require full trust to run. Because you are running from a network share it looks like you are running in a lower trust level. In the past we have made the decision that the migrations commands would require full trust because it reduces the complexity of the implementation.
http://entityframework.codeplex.com/workitem/856
This means you have to put your project on a local drive, then you'll be able to run migrations.
It turns out that #Stijn's answer is indeed correct, However it doesn't provide a solution to the problem, the solution is to simple copy and paste the entire project into your Hard Drive and the command will work

Resources