Can we import build.sbt in build.gradle or any plugins to invoke build.sbt?

buildship
plugins
not-a-bug

(Surender Bandi) #1

Hi,

I have a Play Framework project with build.sbt.
My organization completely uses/supports gradle and not SBT.
I want to use Playframework (Gradle don’t support Play) to build a POC.

Now my idea is to use Gradle as a thin layer above SBT.
Some thing like Jenkins invokes Gradle and gradle invokes sbt which will build my application.

Can you help me to know if gradle supports to import build.sbt in build.gradle or any plugins/way to invoke build.sbt?
I got stuck with this since a long time and seeking a help.

Thanks!
Surender Bandi.


(Sterling Greene) #2

Gradle can build Play applications:
https://docs.gradle.org/current/userguide/play_plugin.html


(Surender Bandi) #3

Thanks Sterling.
Yes it can but till 2.4 version of Play.
I’m using the latest version of Play where there is no support from Gradle.
Did you try with Play latest version 2.6 with gradle?


(Sterling Greene) #4

I believe that it works up until Play 2.6.2 or so in Gradle 4.2: https://docs.gradle.org/4.2/release-notes.html#better-play-support

And in the next release (4.4) will support the latest Play 2.6.x.


(Surender Bandi) #5

That is an awesome information.
Thanks Sterling.
Any clue on the date of gradle 4.4 release?


(Sterling Greene) #6

An RC will be out in the next couple of weeks, so probably a final release ~early December.


(Surender Bandi) #7

Cool.
So you should be updating the doc (https://docs.gradle.org/current/userguide/play_plugin.html) with the latest configurations and play supported versions in 4.4.
Do we still say its in incubating state like “Support for building Play applications is currently incubating” in 4.4?


(sivakumar gopalakrishnan) #8

Hey sterling!

we are doing an application that uses play 2.6.2, scala 2.11, and Gradle 4.3.1.

In that while i am trying to build my application using “gradlew runPlayBinary”, I am getting
an exception says,

Failed to run Play
org.gradle.internal.UncheckedException: java.lang.NoSuchMethodException: play.core.server.DevServerStart$.mainDevHttpMode(play.core.BuildLink, play.core.BuildDocHandler, int, java.lang.String)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
at org.gradle.scala.internal.reflect.ScalaMethod.getMethod(ScalaMethod.java:43)
at org.gradle.scala.internal.reflect.ScalaMethod.(ScalaMethod.java:32)
at org.gradle.scala.internal.reflect.ScalaMethod.(ScalaMethod.java:36)
at org.gradle.scala.internal.reflect.ScalaReflectionUtil.scalaMethod(ScalaReflectionUtil.java:21)

	While surfing i found that in scala 2.11 the DevServerStart$.mainDevHttpMode method accpets 3 pamaeters.
	Scal 2.10 alone accepts 4 parameters. I got stuck here. Please provide any solution to overcome this error.

Here is my build.gradle file
plugins {
id 'play’
id ‘java’
}

allprojects {
repositories {
jcenter()
maven {
name "typesafe-maven-release"
url “https://repo.typesafe.com/typesafe/maven-releases
}
ivy {
name "typesafe-ivy-release"
url "https://repo.typesafe.com/typesafe/ivy-releases"
layout “ivy”
}
}
}

model {
components {
play {
platform play: ‘2.6.2’, scala: '2.11’
injectedRoutesGenerator = true

        sources {
            twirlTemplates {
                defaultImports = TwirlImports.SCALA
            }
        }
    }
}

}

dependencies {
play "com.typesafe.play:play_2.11:2.6.2"
play "com.typesafe.play:filters-helpers_2.11:2.6.2"
play "com.typesafe.play:play-guice_2.11:2.6.2"
play "com.typesafe.play:play-ws_2.11:2.6.2"
play "commons-lang:commons-lang:2.6"
compile group: ‘org.scala-lang’, name: ‘scala-library’, version: ‘2.11.2’
}