scala: error: not found: object play

I am using default https://github.com/actions/starter-workflows/blob/master/ci/scala.yml for project based on playframework. But CI is failing with error. It is not able to find play while previous step of sbt installation went well.

Error:

[info] Updated file /home/runner/work/bento/bento/project/build.properties: set sbt.version to 1.3.8
[info] Loading project definition from /home/runner/work/bento/bento/project
/home/runner/work/bento/bento/build.sbt:1: error: not found: object play
import play.sbt.PlayImport
       ^
/home/runner/work/bento/bento/build.sbt:15: error: not found: value PlayScala
lazy val root = (project in file(".")).enablePlugins(PlayScala)
                                                     ^
/home/runner/work/bento/bento/build.sbt:18: error: not found: value ws
        ws,
        ^
/home/runner/work/bento/bento/build.sbt:19: error: not found: value guice
        guice,
        ^
[error] sbt.compiler.EvalException: Type error in expression
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
##[error]Process completed with exit code 1.

scala.yml:

name: Scala CI

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK 1.8
      uses: actions/setup-java@v1
      with:
        java-version: 1.8
    - name: Run tests
      run: sbt clean test

Hi @jharitesh108 , 

I tried to use the same scala.yml to build a playframework sample project, the workflow run succeeded . There is my workflow run : https://github.com/zhuorg/play-scala-starter-example/runs/591222539?check_suite_focus=true

Could you please compare your project with this sample project? Such as the project/plugins.sbt file  ,build.sbt file?

Or would you mind sharing your project here? 

Thanks for ur help. I also created just one starter project and enable github action. It worked. https://github.com/smarterhealth/play-starter/runs/591504958?check_suite_focus=true I will compare this with my problematic repo may be some config is not set as per github action expectation. Local build is running without any issue. I will post here later when I get reason. 

Thanks again.

I found the reason. In .gitignore file, I added "

project   

 instead of 

/.project

that’s why in local it was ok but on github action’s shell build was failing. A clear error about missing plugins.sbt file would have helped. 

Wow, I am so glad that you have found the root cause.

For the error message improvement, in my opinion , it would be better if you could share your idea with sbt command team . Thank you for your understanding. 

1 Like