Play app with Maven project layout doesn't compile for Gradle plugin


(Iana Bondarska) #1

I’m creating Scala Play app with Gradle (gradle version 2.6.21, gradle 5.2, scala 2.12).
I’d like to use Maven project layout:

└ main
   └ scala
         └ com.mypackage
               └ MyController.scala

I use 'org.gradle.playframework' version '0.2' plugin. I’ve added following configuration for play plugin to file:

platform play: 2.6.21, scala: 2.12, java: JavaVersion.VERSION_1_9
sourceSets {
  main {
     scala {
       source.setSrcDirs files("src/main/scala")
      source.setSrcDirs files("src/main/resources") 

in routes file I specify 1 route:

GET attribute/:attributeId com.mypackage.MyController.getObject(attributeId Long)

When I run compileScala task - I get an exception:

object MyController is not a member of package com.mypackage

Could you tell me please, is there a way to configure Gradle play plugin to work with maven project layout?

(Marcos Pereira) #2

Hey @yana2301,

Not sure exactly which plugin you are using, but the way you configure additional source folders is describe here in Gradle docs:

And also the example a little below the same page: