0

我编写了一个简单的批处理程序来构建我的项目的一个模块,该模块使用 Maven 构建。

我的批次如下

@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

在上面的代码中,构建命令之后的行没有执行。我已经创建了批处理并为批处理创建了一个快捷方式,并且我更改了快捷方式的属性以将目标更改为 D:\ANGSHU\Build\Build.bat &PAUSE 这使得批处理在完成后等待,但仍然是接下来的两个线条

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

没有执行。谁能帮我解决我的问题?

4

1 回答 1

0

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"
于 2013-11-14T03:17:53.810 回答