How to specify a build folder in Travis?

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

before_script: cd project

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 😅


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

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

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