How to specify a build folder in Travis?

Just write a shell script and use this to build your project. Make sure it works locally. Something like this should do the trick:

build.sh:

#!/bin/sh
cd $TRAVIS_BUILD_DIR/project
sbt ++$TRAVIS_SCALA_VERSION package

.travis.yml:

script: build.sh

I tried using this in my travis.yml file but didnt work

before_script: cd project

Then i tried this

before_install: cd project

And that worked 😅


You could also try adding the following line in your .travis.yml file:

before_script: cd project

Adding below on your .travis.yml file should do it:

before_script: cd <project_name>
script:
  - sbt compile
  - sbt test

Tags:

Travis Ci