에서 작업되었습니다 Powershell 스크립트에서 지난 2 주지 못한 많은 진전이다.
그래서 나는 복사하려는 파일이라는 버전입니다.성의 뿌리에서 내 gradle 프로젝트를 하위 디렉토리처럼"src/main/리소스","src/main/웹 애플리케이션"및"src/main/응용 프로그램"입니다. 면 나는 열심히 코드의 경로를 작동하지만,im 만들려고 노력하는 일반적인을 찾는 디렉토리를 파일을 해당 디렉토리에 있습니다.
내 버전입니다.properties 파일을 복사할 수"resources","웹 애플리케이션"및"응용 프로그램은"디렉토리한 후 실행 powershell 스크립트입니다.
어떻게 할 수 있습니다? 어떤 제안 감사드립니다.
$SourceDirectory = "Projectroot\version.properties"
$folders = gci $SourceDirectory -Recurse -Directory
$jar = "src/main/resources"
$ear = "src/main/application"
$war = "src/main/webapp"
foreach ($folder in Sfolders) {
if (Test-Path $folder/$jar) {
write-host "copying to $folder/$jar"
Copy-Item-Path "{$SourceDirectory}\version.properties" -Destination $folder/$jar -Recurse -Force
}
elseif (Test-Path $folder/$ear) {
write-host "copying to $folder/$ear"
Copy-Item-Path "{$SourceDirectory}\version.properties" -Destination $folder/$ear -Recurse -Force
}
elseif (Test-Path $folder/$war) {
write-host "copying to $folder/$war"
Copy-Item-Path "{$SourceDirectory}\version.properties" -Destination $folder/$war -Recurse -Force
}
else {
Write-Host "No such path"
}
}