我有一个项目,其中build.sbt
不在根目录中,而是在子目录build-sbt
内(出于无关紧要的原因)。我以为我可以使用Travis.CI构建它:
language: scala
scala:
- 2.11.8
jdk:
- oraclejdk8
- openjdk7
- openjdk6
env:
- TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR/build-sbt
但是,它甚至没有尝试使用sbt但是假设,可能是因为它甚至在更改目录之前首先在根目录中查找,并且在此处从过时的Ant构建中找到build.xml
。所以特拉维斯试图运行Ant,它不应该:
$ git clone --depth=50 --branch=sbtfied https://github.com/Sciss/weblaf.git Sciss/weblaf
Cloning into 'Sciss/weblaf'...
remote: Counting objects: 7617, done.
remote: Compressing objects: 100% (4211/4211), done.
remote: Total 7617 (delta 4486), reused 5189 (delta 2765), pack-reused 0
Receiving objects: 100% (7617/7617), 11.24 MiB | 19.61 MiB/s, done.
Resolving deltas: 100% (4486/4486), done.
Checking connectivity... done.
$ cd Sciss/weblaf
$ git checkout -qf 33e4986d7e678a732cf8e18d9e4bedc8a967e3de
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 https://docs.travis-ci.com/user/workers/container-based-infrastructure/ for details.
Setting environment variables from .travis.yml
$ export TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR/build-sbt
$ jdk_switcher use oraclejdk8
Switching to Oracle JDK8 (java-8-oracle), JAVA_HOME will be set to /usr/lib/jvm/java-8-oracle
$ java -Xmx32m -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
$ javac -J-Xmx32m -version
javac 1.8.0_31
Using Scala 2.11.8
$ ant test
Buildfile: build.xml does not exist!
Build failed
The command "ant test" exited with 1.
答案 0 :(得分:0)
以下脚本不是设置环境变量,而是工作:
script:
- cd build-sbt
- sbt ++$TRAVIS_SCALA_VERSION test