bat 파일에서 여러 maven 명령을 실행하는 방법은 무엇입니까?
나는 다음과 같은 배트 파일을 만들었다.
mvn 클리닝mvn 패키지
동작하지 않고 첫 번째 명령어만 실행됩니다.
누가 나 좀 도와줄래?
사용하다
call mvn clean
call mvn package
배치 파일에는 세미콜론이 필요하지 않습니다.그리고 당신이 사용해야 하는 이유는call
그것이다mvn
그 자체는 배치 파일이며 배치 파일은 서로 호출해야 합니다.call
그렇지 않으면 제어가 발신자에게 반환되지 않습니다.
후속 명령어를 명령줄에 에코하는 경우(배치 출력에 표시)에는 다음 작업도 수행해야 합니다.echo on
그 후call mvn
(다음 행에서) 완료됩니다.그 이유는mvn
에코를 끄고 다시 켜지 않습니다.
Joey의 답변은 훌륭하지만, 저처럼 Windows에서 배치 파일로 여러 개의 메이븐 프로젝트를 구축하는 것과 유사한 문제를 알고 있는 사람이라면 더 완벽한 코드 예가 도움이 될 것입니다.
REM maven itself uses a batch file so each mvn must be preceded by "call"
REM the -f flag specifies where the pom.xml is found for the project
REM mvn install will save the target output to %userprofile%\.m2\repository ...
call mvn install -f c:\Users\John\workspace\PropertiesReader\pom.xml
call mvn install -f c:\Users\John\workspace\PropertiesWriter\pom.xml
다음과 같은 원라이너도 사용할 수 있습니다.
call mvn clean package
아직 해야 할 프로젝트가 더 있어, 내가 이런 방망이를 만들었어.
@echo off
SET DEVELOPMENT_HOME=C:\Projects
cd %DEVELOPMENT_HOME%\Project1\
call mvn clean install
cd %DEVELOPMENT_HOME%\Project2\
call mvn clean install
관찰된 바하비우는 MS-DOS 1.0 시대로, 호환성을 위해 보관되어 있습니다.솔루션으로서 Windows 의 콜 기능을 사용하는 방법은 다음과 같습니다.
call mvn clean
call mvn package
"call"은 하나의 배치 프로그램을 다른 배치 프로그램으로부터 실행하고 그것을 서브루틴으로 해석합니다.
부모 파일의 다른 배치 파일을 호출할 때는 "call"을 사용합니다.그러면 제어가 부모 배치 파일로 반환되고 해당 파일이 실행을 계속합니다.
예: mvn 클린 설치 호출
Use these commands in batch file to run ur script. Keep your batch file where
you pom.xml file is housed
set ProjectPath=C:\TetonWorkSpace\PeriodicApplicationCheck
cd %ProjectPath%
mvn clean test -Dxmlfile=Smoke.xml
pause
To Create a Task in Task scheduler:
1. Follow steps as prescribed to create task
2. In the action tab, just place the path of ur batch file as shown below
C:\TetonWorkSpace\PeriodicApplicationCheck\testng.bat
3. You can ignore the rest two options like Add Argument and Start in. Use it
only when there are certain conditions to be used without which the script
becomes dysfunctional.
우리는 개발 목적으로 maven을 만들고 그것을 unix 폴더에 전달하기 위해 다음을 사용할 수 있습니다.
SET projectName=commonutil
cd %gitpath%\%projectName%
call mvn clean install -DskipTests=true %password%
IF %ERRORLEVEL% EQU 0 (Echo No error found) ELSE goto exitdoor
SET jarpath="%gitpath%\%projectName%\target\%projectName%-0.0.1-SNAPSHOT.jar"
copy /Y %jarpath% "%libpath%"
scpg3 %jarpath% %ssh_profile_name%@%hostname%:%dev_lib_folder_name%
사용하다
불러mvn clean package
sample
------
echo %test%
cd %test%\ManaulActionAddNotes-test
call mvn clean
cd %test%\restAuthentication-test
call mvn clean
언급URL : https://stackoverflow.com/questions/6573062/how-to-execute-more-than-one-maven-command-in-bat-file
'programing' 카테고리의 다른 글
UIView 스크린샷을 찍는 방법 (0) | 2023.04.15 |
---|---|
Bash에서 문자열 변수를 연결하는 방법 (0) | 2023.04.15 |
셀에 문자열이 포함되어 있는 경우 (0) | 2023.04.15 |
카멜 케이스를 루비 밑줄 케이스로 변환 (0) | 2023.04.15 |
분리된 HEAD와 마스터/오리지널을 조정하는 방법은 무엇입니까? (0) | 2023.04.10 |