为简单的Spring MVC应用程序构建Travis CI失败

时间:2015-04-01 06:31:59

标签: apache spring-mvc tomcat continuous-integration travis-ci

我创建了一个简单的Spring MVC应用程序,并使用我的localhost上的apache tomcat 7构建和部署。 Travis CI上的同一个应用程序的构建失败,构建日志显示为:

$ git clone --depth=50 --branch=master git://github.com/swarup-donepudi/BidToBuy.git swarup-donepudi/BidToBuy
Cloning into 'swarup-donepudi/BidToBuy'...
remote: Counting objects: 32, done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 32 (delta 7), reused 28 (delta 3), pack-reused 0
Receiving objects: 100% (32/32), 5.35 KiB | 0 bytes/s, done.
Resolving deltas: 100% (7/7), done.
Checking connectivity... done.
$ cd swarup-donepudi/BidToBuy
$ git checkout -qf 4faeebe46b78137ea5676f49e2bf5224a8ffcb90
This job is running on container-based infrastructure, which does not allow use of 'sudo', setuid and setguid executables.
If you require sudo, add 'sudo: required' to your .travis.yml
See http://docs.travis-ci.com/user/workers/container-based-infrastructure/ for details.
$ java -version
java version "1.7.0_76"
Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)
$ javac -version
javac 1.7.0_76
0.92s$ ant deps
Buildfile: /home/travis/build/swarup-donepudi/BidToBuy/build.xml
BUILD FAILED
/home/travis/build/swarup-donepudi/BidToBuy/build.xml:87: /home/travis/build/swarup-donepudi/BidToBuy/C:/tomcat/lib does not exist.
Total time: 0 seconds
The command "ant deps" failed and exited with 1 during .
Your build has been stopped.

build.properties文件:

# Ant properties for building the springapp

appserver.home=C:/tomcat
# for Tomcat 5 use $appserver.home}/server/lib
# for Tomcat 6 use $appserver.home}/lib
appserver.lib=C:/tomcat/lib

deploy.path=C:/tomcat/webapps

tomcat.manager.url=http://localhost:8091/manager/text
tomcat.manager.username=tomcat
tomcat.manager.password=s3cret

.travis.yml文件的内容:

language: java
sudo: false
install: ant deps

我假设可能的原因可能是tomcat lib文件夹的路径。

travis ci如何处理为tomcat服务器配置的构建?我试图找到答案,但却找不到答案。请帮忙

1 个答案:

答案 0 :(得分:1)

我猜你所提供的路径对Travis CI环境无效:

/home/travis/build/swarup-donepudi/BidToBuy/C:/tomcat/lib does not exist

正如您在属性文件中说明的那样:

C:/tomcat

考虑到Travis CI在Linux容器中运行构建,因此您必须探索部署应用程序的其他方法。

当您使用Spring时,也许您应该尝试使用Spring Boot,因为它附带了一个嵌入式Tomcat服务器,因此可以从构建脚本中解放出来。