.sh
스크립트를 실행하려면 다음 플러그인을 데
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>deploy-bundles</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/deploy.sh</executable>
<successCodes>
<successCode>0</successCode> <-- Not working
</successCodes>
</configuration>
</execution>
</executions>
</plugin>
복사하는 특정 위치에 일부 폴더 및 파일을. 그것은 작동합니다. 그러나, 필자는 fail-on-error 메커니즘을 원합니다. 이미 내 .sh
스크립트에 set -e
명령이 있지만, 나는 또한 maven 솔루션을 원합니다. successCodes
이라고하는 tag이 있다고 들었습니다.이를 통합하려고합니다. 그러나 지금까지 행운이 없습니다. 누군가 올바른 방법을 지적 할 수 있습니까?
편집 : 내 .sh
스크립트는 다음과 같습니다
cp ../template/config.properties $component/conf
cp ../../runtime/group1/group1.mw/conf/log4j.xml $component/conf
# if the component is planning, create an additional folder called plans
if [[ $component == *".planning"* ]]
then
mkdir -p $component/plans
# copy all the plans here
cp ../../mission.planning/plans/* $component/plans
fi
/파일이 없습니다. 따라서 테스트로서 위의 경로를 수동으로 변경하고 실패 할 것으로 예상합니다. 그것은 실행 프로세스에 실패하고 나에게 오류를 알려주지 만 (.sh
스크립트에 set -e
명령이 있기 때문에), 그러나 메이븐 보고서는 "성공"으로 표시됩니다.
완벽한 답변입니다. 감사합니다. –