I am new in using Play framework. I am trying to generate Q classes in play framework project. When I compile program using activator by running command compile it did not generate Q classes.
My build.sbt content is
import codetroopers.QueryDSLPlugin
import play.PlayJava
name := """trainers"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava, QueryDSLPlugin)
scalaVersion := "2.11.1"
libraryDependencies ++= Seq(
cache,
javaWs,
filters,
javaJdbc,
javaJpa.exclude("org.hibernate.javax.persistence", "hibernate-jpa-2.0-api"),
"org.hibernate" % "hibernate-entitymanager" % "4.3.6.Final",
"org.hibernate" % "hibernate-core" % "4.3.6.Final",
"org.hibernate" % "hibernate-validator" % "5.2.0.Beta1",
"javax.el" % "javax.el-api" % "2.2.4",
"commons-io" % "commons-io" % "2.3",
"com.google.inject" % "guice" % "3.0",
"com.google.inject.extensions" % "guice-multibindings" % "3.0",
"org.postgresql" % "postgresql" % "9.3-1101-jdbc41",
"com.mysema.querydsl" % "querydsl-apt" % "3.6.3",
"com.mysema.querydsl" % "querydsl-jpa" % "3.6.3",
"com.typesafe.play.plugins" %% "play-plugins-mailer" % "2.3.1",
"org.apache.commons" % "commons-collections4" % "4.0",
"org.mindrot" % "jbcrypt" % "0.3m",
"com.typesafe.play" %% "play-mailer" % "2.4.0",
"redis.clients" % "jedis" % "2.7.0",
"com.restfb" % "restfb" % "1.14.0",
"org.json" % "org.json" % "chargebee-1.0",
"com.fasterxml.jackson.core" % "jackson-core" % "2.5.3",
"net.greghaines" % "jesque" % "2.0.2",
"org.apache.velocity" % "velocity" % "1.7",
"oro" % "oro" % "2.0.8",
"org.liquibase" % "liquibase-core" % "3.2.2",
"com.twilio.sdk" % "twilio-java-sdk" % "4.4.1",
"com.googlecode.libphonenumber" % "libphonenumber" % "7.0.7",
"com.google.code.gson" % "gson" % "2.2.2",
"com.paypal.sdk" % "rest-api-sdk" % "1.2.5",
"com.paypal.sdk" % "paypal-core" % "1.6.4",
"com.paypal.sdk" % "merchantsdk" % "2.13.117"
)
javaOptions in Test += "-Dconfig.file=test/conf/application.test.conf"
queryDSLVersion := "3.6.3"
My plugin.sbt:
resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.8")
// web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")
addSbtPlugin("com.code-troopers.play" % "play-querydsl" % "0.1.2")
Do I need to run any specific command to generate the classes. My Scala version is 2.11.7. My Activator version is 1.3.6.
Related
Similarly to:
Why is UNRESOLVED DEPENDENCIES error with com.typesafe.slick#slick_2.11;2.0.2: not found?
I got the next error message:
events/*:update) sbt.ResolveException: unresolved dependency: com.typesafe.slick#slick-extensions_2.11;3.1.0: not found
My scala build.sbt has:
lazy val events = (project in file("modules/events")).settings(commonSettings).
settings(Seq(libraryDependencies ++= Seq(
cache,
ws,
evolutions,
specs2,
"com.softwaremill.macwire" %% "macros" % "2.2.5" % "provided",
"com.softwaremill.macwire" %% "util" % "2.2.0",
"ch.qos.logback" % "logback-classic" % "1.1.8",
"de.svenkubiak" % "jBCrypt" % "0.4.1",
"org.scalatestplus.play" %% "scalatestplus-play" % "1.5.0" % "test",
"org.mockito" % "mockito-core" % "2.0.45-beta" % "test",
"mysql" % "mysql-connector-java" % "5.1.34",
"org.postgresql" % "postgresql" % "9.4.1207.jre7",
"com.vividsolutions" % "jts" % "1.13",
"com.typesafe.play" % "play-slick_2.11" % "2.0.2",
"com.typesafe.play" %% "play-slick-evolutions" % "2.0.0",
"com.github.tminglei" %% "slick-pg" % "0.12.1",
"com.github.tminglei" %% "slick-pg_date2" % "0.12.1",
"com.github.tminglei" %% "slick-pg_play-json" % "0.12.1",
"com.typesafe.slick" %% "slick-extensions" % "3.1.0",
"org.scalikejdbc" %% "scalikejdbc" % "2.4.2",
"org.scalikejdbc" %% "scalikejdbc-config" % "2.4.2",
"joda-time" % "joda-time" % "2.9.4",
"com.typesafe.play" %% "play-json" % "2.5.9",
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"io.circe" %% "circe-jawn" % circeVersion,
"com.github.julien-truffaut" %% "monocle-core" % monocleVersion,
"com.github.julien-truffaut" %% "monocle-macro" % monocleVersion,
"com.github.julien-truffaut" %% "monocle-law" % monocleVersion % "test",
"com.microsoft.sqlserver" % "mssql-jdbc" % "7.4.1.jre8"
)))
I am also using Scala 2.11.9. I also tried adding
resolvers += "typesafe" at "http://repo.typesafe.com/typesafe/releases/"
but no luck. Any suggestions, please?
Actually slick-extensions is not located in http://repo.typesafe.com/typesafe/releases/. If you will look there you will see that com/typesafe/slick/slick-extensions_2.11/ is empty.
But I have found it here https://typesafe.bintray.com/commercial-maven-releases/com/typesafe/slick/slick-extensions_2.11/3.1.0/
And here some information about slick-extensions: https://index.scala-lang.org/slick/slick/slick-extensions/3.1.0.
They recommend using that:
libraryDependencies += "com.typesafe.slick" %% "slick-extensions" % "3.1.0"
resolvers += Resolver.bintrayRepo("typesafe", "commercial-maven-releases")
I'm trying to build a Scala project based on the framework Play using the sbt. When I try to launch "sbt compile" from my terminal I get several compilation errors like the following one:
[error] <project.dir>/app/controllers/Application.scala:229:
object database is not a member of package views.html
[error] Ok(views.html.database(t2, JsonHelpers.TotalTip.langsForm))
[error] ^
This is my build.sbt file:
import play.sbt.PlayImport._
import com.typesafe.sbt.less.Import.LessKeys
name := """<app_name>"""
lazy val root = (project in file("."))
.enablePlugins(PlayScala)
.enablePlugins(GatlingPlugin)
.enablePlugins(BuildInfoPlugin, GitVersioning, GitBranchPrompt)
.settings(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "app")
https://github.com/puffnfresh/wartremover/issues/182
wartremoverWarnings ++= Warts.unsafe.filter(_ != Wart.Throw)
git.useGitDescribe := true
routesGenerator := InjectedRoutesGenerator
fork in run := true
scalaVersion := "2.11.8"
libraryDependencies += "com.typesafe.play" %% "play-json" % "2.5.4"
libraryDependencies ++= Seq(
jdbc,
cache,
ws,
filters,
specs2 % Test,
"com.typesafe.play" % "anorm_2.11" % "2.5.0",
"org.webjars" % "bootstrap" % "3.3.2",
"org.webjars" % "metisMenu" % "1.1.3",
"org.webjars" % "morrisjs" % "0.5.1",
"org.webjars" % "font-awesome" % "4.3.0",
"org.webjars" % "jquery" % "2.1.3",
"org.webjars" % "flot" % "0.8.3",
"org.webjars" % "datatables" % "1.10.5",
"org.webjars" % "datatables-plugins" % "1.10.5",
"com.newrelic.agent.java" % "newrelic-agent" % "3.14.0",
"com.newrelic.agent.java" % "newrelic-api" % "3.14.0",
"org.pac4j" % "play-pac4j" % "2.6.2",
"org.pac4j" % "pac4j-saml" % "1.9.5",
"org.pac4j" % "pac4j-sql" % "1.9.5",
"org.pac4j" % "pac4j-oidc" % "1.9.5" exclude("commons-io" , "commons-io"),
"org.pac4j" % "pac4j-openid" % "1.9.5" exclude("xml-apis" , "xml-apis"),
"org.pac4j" % "pac4j-jwt" % "1.9.5" exclude("commons-io" , "commons-io"),
"org.pac4j" % "pac4j-mongo" % "1.9.5",
"org.pac4j" % "pac4j-http" % "1.9.5",
"org.pac4j" % "pac4j-oauth" % "1.9.5",
"org.pac4j" % "pac4j-stormpath" % "1.9.5",
"com.typesafe.play" % "play-cache_2.11" % "2.5.4",
"org.pac4j" % "pac4j-http" % "1.9.5",
"org.pac4j" % "pac4j-cas" % "1.9.5",
"commons-io" % "commons-io" % "2.5"
)
includeFilter in (Assets, LessKeys.less) := "sb-admin-2.less" | "tables.less"
libraryDependencies += "io.gatling.highcharts" % "gatling-charts-highcharts" % "2.1.7"
libraryDependencies += "io.gatling" % "gatling-test-framework" % "2.1.7"
libraryDependencies += "org.scalaz" %% "scalaz-core" % "7.1.5"
libraryDependencies += "org.reactivemongo" %% "reactivemongo" % "0.11.10"
libraryDependencies += "io.swagger" %% "swagger-play2" % "1.6.0"
libraryDependencies += "com.github.tototoshi" %% "play-json-naming" % "1.0.0"
libraryDependencies += "com.github.tototoshi" %% "scala-csv" % "1.3.4"
libraryDependencies += "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.8.7"
libraryDependencies += "com.github.nscala-time" %% "nscala-time" % "2.16.0"
resolvers ++= Seq(Resolver.mavenLocal, "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases", "Sonatype snapshots repository" at "https://oss.sonatype.org/content/repositories/snapshots/", "<internal repo>" at "<repo_url>")
Is it a dependencies issue? Does anyone have an idea why I get these errors?
Thanks
sbt clean compile
sometime that helps
if not have a look at https://www.playframework.com/documentation/2.5.x/IDE
I've imported Specs2 and everything looks good but some things that are not imported, among them the PlaySpecification trait.
I've tried to reload in sbt, to invalidate caches in Intellij ... But this trait is missing!
My built.sbt
name := """web2"""
version := "1.0-SNAPSHOT"
scalaVersion := "2.12.2"
lazy val root = (project in file(".")).enablePlugins(PlayScala, LauncherJarPlugin)
pipelineStages := Seq(digest)
libraryDependencies ++= Seq(
evolutions,
jdbc,
ehcache,
ws,
"com.softwaremill.macwire" %% "macros" % "2.3.0" % "provided",
"org.postgresql" % "postgresql" % "42.1.1",
"org.scalikejdbc" %% "scalikejdbc" % "3.0.0",
"org.scalikejdbc" %% "scalikejdbc-config" % "3.0.0",
"ch.qos.logback" % "logback-classic" % "1.2.3",
"de.svenkubiak" % "jBCrypt" % "0.4.1",
//"org.scalatestplus.play" %% "scalatestplus-play" % "3.0.+" % "test",
"org.mockito" % "mockito-core" % "2.7.22" % "test",
"org.specs2" %% "specs2-core" % "3.9.+" % "test"
)
resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"
plugins.sbt
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.3")
// Web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.2")
According to the documentation, replace "org.specs2" %% "specs2-core" % "3.9.+" % "test" with specs2 % Test in your dependencies:
libraryDependencies ++= Seq(
evolutions,
jdbc,
ehcache,
...
"org.mockito" % "mockito-core" % "2.7.22" % "test",
specs2 % Test
)
I have been trying to get slick's schema code generation to work. This is the method I'm using to run slicks code generator and the result that I'm getting.
scala>slick.codegen.SourceCodeGenerator.main(Array("slick.driver.MySQLDriver","com.mysql.jdbc.Driver","jdbc:mysql://localhost/adivinate","/Users/roy/adivinate/survey2/app/database","database","root","root"))
java.lang.NoSuchMethodError: slick.driver.JdbcProfile$API.Database()Lslick/backend/DatabaseComponent$DatabaseFactoryDef;
at slick.codegen.SourceCodeGenerator$.run(SourceCodeGenerator.scala:65)
at slick.codegen.SourceCodeGenerator$.main(SourceCodeGenerator.scala:94)
... 42 elided
scala>
I think I am missing a dependency but I don't know how to find it.
Here is my build.sbt.
name := """adivinate"""
version := "0.0.1"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.8"
incOptions := incOptions.value.withNameHashing(true)
updateOptions := updateOptions.value.withCachedResolution(cachedResoluton = true)
libraryDependencies ++= {
val ngVersion="2.2.0"
Seq(
cache,
evolutions,
//angular2 dependencies
"org.webjars.npm" % "angular__common" % ngVersion,
"org.webjars.npm" % "angular__compiler" % ngVersion,
"org.webjars.npm" % "angular__core" % ngVersion,
"org.webjars.npm" % "angular__http" % ngVersion,
"org.webjars.npm" % "angular__forms" % ngVersion,
"org.webjars.npm" % "angular__router" % "3.2.0",
"org.webjars.npm" % "angular__platform-browser-dynamic" % ngVersion,
"org.webjars.npm" % "angular__platform-browser" % ngVersion,
"org.webjars.npm" % "systemjs" % "0.19.40",
"org.webjars.npm" % "rxjs" % "5.0.0-beta.12",
"org.webjars.npm" % "reflect-metadata" % "0.1.8",
"org.webjars.npm" % "zone.js" % "0.6.26",
"org.webjars.npm" % "core-js" % "2.4.1",
"org.webjars.npm" % "symbol-observable" % "1.0.1",
"org.webjars.npm" % "typescript" % "2.1.4",
//tslint dependency
"org.webjars.npm" % "tslint-eslint-rules" % "3.1.0",
"org.webjars.npm" % "tslint-microsoft-contrib" % "2.0.12",
// "org.webjars.npm" % "codelyzer" % "2.0.0-beta.1",
"org.webjars.npm" % "types__jasmine" % "2.2.26-alpha" % "test",
//test
// "org.webjars.npm" % "jasmine-core" % "2.4.1"
//database dependencies
"mysql" % "mysql-connector-java" % "5.1.30",
//"com.typesafe.slick" % "slick_2.11" % "3.1.1", //included in play-slick
"com.typesafe.play" %% "play-slick" % "2.0.0",
"com.typesafe.play" %% "play-slick-evolutions" % "2.0.0",
"com.typesafe.slick" %% "slick-codegen" % "3.0.0",
"org.scala-lang" % "scala-reflect" % "2.12.1"
)
}
dependencyOverrides += "org.webjars.npm" % "minimatch" % "3.0.0"
// use the webjars npm directory (target/web/node_modules ) for resolution of module imports of angular2/core etc
resolveFromWebjarsNodeModulesDir := true
// use the combined tslint and eslint rules plus ng2 lint rules
(rulesDirectories in tslint) := Some(List(
tslintEslintRulesDir.value,
ng2LintRulesDir.value
))
logLevel in tslint := Level.Debug
routesGenerator := InjectedRoutesGenerator
fork in run := true
I am upgrading Play Framework application from 2.2.2(application working fine with this version) to 2.4.4(Typesafe activator 1.3.7), while running the application, I am getting the following errors:
build.sbt:
name := """MyFirstApp"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.6"
libraryDependencies ++= Seq(
javaJdbc,
cache,
javaWs,
jdbc,
cache,
//anorm
"com.typesafe.play" %% "anorm" % "2.4.0",
"com.google.inject" % "guice" % "4.0",
"javax.inject" % "javax.inject" % "1",
"org.reactivemongo" %% "play2-reactivemongo" % "0.11.9",
"org.reactivemongo" %% "reactivemongo" % "0.10.0",
"org.reactivemongo" %% "play2-reactivemongo" % "0.10.2",
"org.mockito" % "mockito-core" % "1.9.5" % "test",
"org.webjars" % "requirejs" % "2.1.1",
"org.postgresql" % "postgresql" % "9.4-1200-jdbc41",
"postgresql" % "postgresql" % "9.1-901.jdbc4",
"com.typesafe.play" % "play-iteratees_2.10" % "2.2.3",
"com.typesafe.slick" % "slick_2.10" % "2.1.0",
"com.typesafe.play" % "play-jdbc_2.10" % "2.2.0-RC1",
"com.typesafe.play" % "play-jdbc_2.10" % "2.4.4",
"org.apache.flume" % "flume-ng-core" % "1.5.2",
"org.apache.flume" % "flume-ng-sdk" % "1.5.2",
"org.scala-lang" % "scala-compiler" % "2.11.6"
)
// Play provides two styles of routers, one expects its actions to be injected, the
// other, legacy style, accesses its actions statically.
routesGenerator := InjectedRoutesGenerator
// Compile the project before generating Eclipse files, so that generated .scala or .class files for views and routes are present
//EclipseKeys.preTasks := Seq(compile in Compile)
plugins.sbt:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.4")
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")
// addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0")
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
//EclipseKeys.projectFlavor := EclipseProjectFlavor.Java // Java project. Don't expect Scala IDE
//EclipseKeys.createSrc := EclipseCreateSrc.ValueSet(EclipseCreateSrc.ManagedClasses, EclipseCreateSrc.ManagedResources) // Use .class files instead of generated .scala files for views and routes
logLevel := Level.Warn
// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
Please help me regarding to run the application perfectly. Thanks in advance.