简体   繁体   中英

Batch program to build a module of my project

I have written a simple batch program to build a module of my project which builds using Maven.

My batch is as follows

@echo off

set jarBuildPath=D:\ANGSHU\project-

:jar
  set /p module=Enter Which Module You Want To Build?[e.g. test]

  pushd %jarBuildPath%%module%
  IF %ERRORLEVEL% ==1  (
echo.
echo Module you entered [%module%] does not exist
goto jar
  )
  echo Build process started...
  build -Dmaven.test.skip clean install > %module%-build-output-log.txt
  echo Build process is over...
  start "" "%jarBuildPath%%module%\%module%-build-output-log.txt"
GOTO End1

:End1

In the above code the lines after the build command is not executing. I have created the batch and created a shortcut for the batch and i have changed the properties of the shortcut to change the target as D:\\ANGSHU\\Build\\Build.bat &PAUSE which makes the batch wait after it finishes but still the next two lines

echo Build process is over...
start "" "%jarBuildPath%%module%\%module%-build-output-log.txt"

is not executing.Can anyone help me with my problem??

Looks to me like the file is not being written where you thought it was. This does not do what you might have expected:

pushd %jarBuildPath%%module%

Perhaps you wanted:

pushd .
cd %jarBuildPath%%module%

REM build etc...

popd

Of course, you could be more specific instead:

build -Dmaven.test.skip clean install > "%jarBuildPath%%module%\%module%-build-output-log.txt"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM