mirror of
https://github.com/actions/runner-images.git
synced 2025-12-11 19:46:46 +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 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.
|
||||
$userEnvironmentKey = 'Registry::HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
|
||||
|
||||
$m2_home = (Get-ItemProperty -Path $userEnvironmentKey -Name M2_HOME).M2_HOME
|
||||
$m2 = $m2_home + '\bin'
|
||||
# Add maven env variables to Machine
|
||||
[string]$m2 = (Get-MachinePath).Split(";") -match "maven"
|
||||
$maven_opts = '-Xms256m'
|
||||
|
||||
$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_REPO $m2_repo /M
|
||||
|
||||
Reference in New Issue
Block a user