mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 20:56:47 +00:00
[Windows] Do not use M2_HOME env var to get mvn path (#4333)
* Do not use M2_HOME env var to get mvn path * use Get-MachinePath to get mvn path
This commit is contained in:
committed by
GitHub
parent
283bac3995
commit
77e299148d
@@ -134,15 +134,12 @@ Choco-Install -PackageName ant -ArgumentList "-i"
|
|||||||
Choco-Install -PackageName maven -ArgumentList "-i"
|
Choco-Install -PackageName maven -ArgumentList "-i"
|
||||||
Choco-Install -PackageName gradle
|
Choco-Install -PackageName gradle
|
||||||
|
|
||||||
# Move maven variables to Machine. They may not be in the environment for this script so we need to read them from the registry.
|
# Add maven env variables to Machine
|
||||||
$userEnvironmentKey = 'Registry::HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
|
[string]$m2 = (Get-MachinePath).Split(";") -match "maven"
|
||||||
|
|
||||||
$m2_home = (Get-ItemProperty -Path $userEnvironmentKey -Name M2_HOME).M2_HOME
|
|
||||||
$m2 = $m2_home + '\bin'
|
|
||||||
$maven_opts = '-Xms256m'
|
$maven_opts = '-Xms256m'
|
||||||
|
|
||||||
$m2_repo = 'C:\ProgramData\m2'
|
$m2_repo = 'C:\ProgramData\m2'
|
||||||
New-Item -Path $m2_repo -ItemType Directory -Force
|
New-Item -Path $m2_repo -ItemType Directory -Force | Out-Null
|
||||||
|
|
||||||
setx M2 $m2 /M
|
setx M2 $m2 /M
|
||||||
setx M2_REPO $m2_repo /M
|
setx M2_REPO $m2_repo /M
|
||||||
|
|||||||
Reference in New Issue
Block a user