0

我正在为我的 CI 服务器使用 jenkins,但是当我想构建项目时遇到问题,因为 jenkins 无法识别编译错误。这是我的问题:

creating objects directory obj
g++ -I../src -I third-party/cppunit-1.12.1/include -fPIC -g -Wall -c booktest.cpp -o obj/booktest.o
g++ -I../src -I third-party/cppunit-1.12.1/include -fPIC -g -Wall -c reader/bookreadertest.cpp -o obj/reader/bookreadertest.o
g++ -I../src -I third-party/cppunit-1.12.1/include -fPIC -g -Wall -c indexer/indexertest.cpp -o obj/indexer/indexertest.o
indexer/indexertest.cpp: In constructor ‘IndexerTest::IndexerTest()’:
indexer/indexertest.cpp:17:12: error: ‘failMethod’ was not declared in this scope
make: *** [obj/indexer/indexertest.o] Error 1
creating objects directory obj
g++ -I ../src -fPIC -g -Wall -c src/main.cpp -o obj/src/main.o
g++ -o oreallybooks -fPIC -g -Wall obj/src/main.o -L/user/local/lib -L../src/lib -loreally -lm
Finished: SUCCESS



I am using  bash files to build and clean the cpp project
I "execute shell" for "build steps" in jenkins and this is the command:

/var/lib/jenkins/jobs/OreallyBooks/workspace/buildProject

"buildProject" is bash file and contains:


!/bin/bash
cd src;
make;
cd ../test;
make;
cd ../ui
make;

有人可以帮助我吗?谢谢大家

4

1 回答 1

1

如果最终 make 以外的任何其他操作失败,则 bash 脚本将忽略该错误。

您需要将脚本设置为在第一个错误时失败

#!/bin/bash -e

停止第一个错误

于 2013-08-22T20:34:28.120 回答