title: Scala Play: object index is not a member of package views.html
body: <p>I'm getting </p>
  
  <pre><code>object index is not a member of package views.html
  </code></pre>
  
  <p>but unlike all the other threads opened on this subject, my issue seems totally unrelated to the IDE. I get this issue from the command line (no IDE) no matter how much I try to clean and rebuild by running</p>
  
  <pre><code>activator clean compile run
  </code></pre>
  
  <p>or just</p>
  
  <pre><code>sbt clean compile
  </code></pre>
  
  <p>Here is my conf/routes:</p>
  
  <pre><code>GET      /                   controllers.Application.index
  GET      /books              controllers.Application.listBooks
  POST     /books              controllers.Application.upload
  
  GET     /assets/*file        controllers.Assets.at(path="/public", file)
  </code></pre>
  
  <p>This si my views/index.scala.html:</p>
  
  <pre><code>@import play.api.data.Form
  @import models.Book
  
  @(form: Form[Book])(implicit messages: Messages)
  
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;xxx&lt;/title&gt;
          &lt;link rel="stylesheet" type="text/css" media="screen" href='@routes.Assets.at("stylesheets/main.css")'&gt;
          &lt;script type="text/javascript" href='@routes.Assets.at("javascripts/jquery-1.9.0.min.js")'&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
  
          &lt;div class="screenshot"&gt;
  
              &lt;div class="navbar navbar-fixed-top"&gt;
                  &lt;div class="navbar-inner"&gt;
                      &lt;div class="container"&gt;
                          &lt;a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt;
                          &lt;/a&gt; &lt;a class="brand" href="#"&gt;Workday Dublin CTF&lt;/a&gt;
  
                          &lt;div class="nav-collapse"&gt;
                              &lt;ul class="nav"&gt;
  
                              &lt;/ul&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
                  &lt;h1&gt;All Your Books Are Belong To Us&lt;/h1&gt;
                  &lt;div class="container"&gt;
  
                      &lt;h2&gt;Add Book&lt;/h2&gt;
                      @helper.form(action = routes.Application.upload, 'enctype -&gt; "multipart/form-data") {
  
                          @helper.inputText(form("title"))
                          @helper.inputText(form("author"))
                          @helper.inputFile(form("myUpload"))
  
                          &lt;div class="form-actions"&gt;
                              &lt;button type="submit" class="btn btn-primary"&gt;Create Book&lt;/button&gt;
                          &lt;/div&gt;
                      }
  
                  &lt;/div&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Finally, here is where the error is thrown, in my controllers/Application.scala:</p>
  
  <pre><code>package controllers
  
  import models.Book
  import models.Book._
  import play.api.mvc._
  
  class Application extends Controller {
  
    def index = Action {
      Ok(views.html.index(Book.form))
    }
  
    def listBooks = Action {
      Ok(books.head.myUpload)
    }
  
    def upload() = Action(parse.multipartFormData) { request =&gt;
      request.body.file("myUpload").map { myUpload =&gt;
        import java.io.File
        val filename = myUpload.filename
        val contentType = myUpload.contentType
        myUpload.ref.moveTo(new File(s"/tmp/$filename"))
        addBook(Book("xxxtitle", "xxxauthor", filename))
        Ok("File uploaded at /tmp/"+filename)
      }.getOrElse {
        Redirect(routes.Application.index).flashing(
          "error" -&gt; "Missing file")
      }
    }
  }
  </code></pre>
  
  <p>The error is thrown at Ok(views.html.index(Book.form)) which references models/Book.scala:</p>
  
  <pre><code>package models
  
  import play.api.data.Form
  import play.api.data.Forms._
  
  case class Book(title: String, author: String, myUpload: String)
  
  object Book {
  
    var books = List(Book("title test 1", "author test 1", "filename test 1"))
  
    def addBook(book: Book) = books = books ::: List(book)
  
    val form = Form(mapping(
      "title" -&gt; text,
      "author" -&gt; text,
      "myUpload" -&gt; nonEmptyText)(Book.apply)(Book.unapply))
  }
  </code></pre>
  
  <p>As I've researched a lot about this, and no other solution has worked so far, any help would be immensely appreciated. Thank you so much!</p>