48 lines
2.0 KiB
PowerShell
48 lines
2.0 KiB
PowerShell
# Download Gradle 8.5
|
|
$version = "8.5"
|
|
$downloadUrl = "https://services.gradle.org/distributions/gradle-$version-bin.zip"
|
|
$outputDir = "D:\Desktop\Project\Part"
|
|
$outputFile = Join-Path $outputDir "gradle-$version-bin.zip"
|
|
|
|
Write-Host "Downloading Gradle $version..." -ForegroundColor Cyan
|
|
Write-Host "URL: $downloadUrl" -ForegroundColor Yellow
|
|
|
|
if (-not (Test-Path $outputDir)) {
|
|
New-Item -ItemType Directory -Path $outputDir -Force | Out-Null
|
|
}
|
|
|
|
try {
|
|
# Use Aliyun mirror (faster in China)
|
|
$aliyunUrl = "https://mirrors.cloud.tencent.com/gradle/gradle-$version-bin.zip"
|
|
|
|
Write-Host "Trying Tencent mirror..." -ForegroundColor Yellow
|
|
Invoke-WebRequest -Uri $aliyunUrl -OutFile $outputFile -ErrorAction Stop
|
|
Write-Host "Download completed!" -ForegroundColor Green
|
|
} catch {
|
|
Write-Host "Mirror failed, trying official site..." -ForegroundColor Yellow
|
|
try {
|
|
Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile -ErrorAction Stop
|
|
Write-Host "Download completed!" -ForegroundColor Green
|
|
} catch {
|
|
Write-Host "Download failed: $_" -ForegroundColor Red
|
|
Write-Host "Please download manually from: $downloadUrl" -ForegroundColor Yellow
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "Extracting..." -ForegroundColor Cyan
|
|
Expand-Archive -Path $outputFile -DestinationPath $outputDir -Force
|
|
Write-Host "Extracted to: $outputDir\gradle-$version" -ForegroundColor Green
|
|
|
|
Write-Host ""
|
|
Write-Host "================================================" -ForegroundColor Green
|
|
Write-Host "Gradle 8.5 installed successfully!" -ForegroundColor Green
|
|
Write-Host "Path: $outputDir\gradle-$version" -ForegroundColor Cyan
|
|
Write-Host "================================================" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "Next steps:" -ForegroundColor Yellow
|
|
Write-Host "1. Open HBuilderX" -ForegroundColor White
|
|
Write-Host "2. Tools -> Settings -> Runtime Configuration" -ForegroundColor White
|
|
Write-Host "3. Set Gradle path to: $outputDir\gradle-$version" -ForegroundColor Cyan
|