如何在 Play 2.2 中启用 play-querydsl 插件?
How to enable play-querydsl plugin in Play 2.2?
我在 play 2.2.6 中使用 scala 2.10.3 和 java 1.7
设置 querydsl 框架时遇到问题
我已经完成了与 documentation 中完全相同的安装。但是没用。
我遇到了一个错误:
dany@dany1L:~/git/app$ playFramework-2.2.6
[info] Loading project definition from /home/dany/git/app/project
/home/dany/git/app/build.sbt:11: error: not found: value QueryDSLPlugin
val current = project.in(file(".")).configs(QueryDSLPlugin.QueryDSL)
^
[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?
这是我的 project/plugins.sbt:
// Comment to get more information during initialization
logLevel := Level.Warn
// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// Use the Play sbt plugin for Play projects
// changed to support play 2.2.4 addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.6")
addSbtPlugin("com.code-troopers.play" % "play-querydsl" % "0.1.2")
还有我的 build.sbt:
import com.typesafe.config._
import play.Project._
import sbt._
import Keys._
//javacOptions ++= Seq("-Xlint:unchecked")
playJavaSettings
playJavaSettings ++ QueryDSLPlugin.queryDSLSettings
val current = project.in(file(".")).configs(QueryDSLPlugin.QueryDSL)
val conf = ConfigFactory.parseFile(new File("conf/application.conf")).resolve()
name := conf.getString("app.name")
version := conf.getString("app.version")+"_("+conf.getString("app.releaseDate")+")"
libraryDependencies ++= Seq(
javaJdbc,
javaJpa,
"org.hibernate" % "hibernate-entitymanager" % "3.6.9.Final",
"mysql" % "mysql-connector-java" % "5.1.27",
"org.mindrot" % "jbcrypt" % "0.3m",
"org.jasypt" % "jasypt" % "1.9.2",
"org.apache.poi" % "poi" % "3.10.1",
"com.googlecode.genericdao" % "dao" % "1.2.0",
"com.googlecode.genericdao" % "search-jpa-hibernate" % "1.2.0",
"com.google.code.gson" % "gson" % "2.3.1",
"com.googlecode.json-simple" % "json-simple" % "1.1.1",
"javax.mail" % "javax.mail-api" % "1.5.3",
"javax.activation" % "activation" % "1.1.1",
"com.sun.mail" % "javax.mail" % "1.5.3",
"com.querydsl" % "querydsl-jpa" % "4.0.2",
"com.querydsl" % "querydsl-apt" % "4.0.2",
cache
)
请帮帮我
添加后:
import codetroopers._
在 build.sbt
之上我收到一个错误:
[info] Loading project definition from /home/dany/git/app/project
error: bad symbolic reference. A signature in QueryDSLPlugin.class refers to type AutoPlugin
in package sbt which is not available.
It may be completely missing from the current classpath, or the version on
the classpath might be incompatible with the version used when compiling QueryDSLPlugin.class.
[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?
感谢@Nathan
和他的回答 here
经过几天的努力,我终于成功了。
这是我的配置文件:
plugins.sbt
// Comment to get more information during initialization
logLevel := Level.Warn
// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// Use the Play sbt plugin for Play projects
// changed to support play 2.2.4 addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.6")
addSbtPlugin("com.code-troopers.play" % "play-querydsl" % "0.1.1")
和build.sbt
import com.typesafe.config._
import play.Project._
import sbt._
import Keys._
//javacOptions ++= Seq("-Xlint:unchecked")
playJavaSettings
val conf = ConfigFactory.parseFile(new File("conf/application.conf")).resolve()
name := conf.getString("app.name")
version := conf.getString("app.version")+"_("+conf.getString("app.releaseDate")+")"
libraryDependencies ++= Seq(
javaJdbc,
javaJpa,
"org.hibernate" % "hibernate-entitymanager" % "3.6.9.Final",
"mysql" % "mysql-connector-java" % "5.1.27",
"org.mindrot" % "jbcrypt" % "0.3m",
"org.jasypt" % "jasypt" % "1.9.2",
"org.apache.poi" % "poi" % "3.10.1",
"com.googlecode.genericdao" % "dao" % "1.2.0",
"com.googlecode.genericdao" % "search-jpa-hibernate" % "1.2.0",
"com.google.code.gson" % "gson" % "2.3.1",
"com.googlecode.json-simple" % "json-simple" % "1.1.1",
"javax.mail" % "javax.mail-api" % "1.5.3",
"javax.activation" % "activation" % "1.1.1",
"com.sun.mail" % "javax.mail" % "1.5.3",
"com.querydsl" % "querydsl-jpa" % "4.0.2",
"com.querydsl" % "querydsl-apt" % "4.0.2",
cache
)
playJavaSettings ++ QueryDSLPlugin.queryDSLSettings
val current = project.in(file(".")).configs(QueryDSLPlugin.QueryDSL)
QueryDSLPlugin.queryDSLPackage := "models"
和build.properties
sbt.version=0.13.0
我在 play 2.2.6 中使用 scala 2.10.3 和 java 1.7
设置 querydsl 框架时遇到问题我已经完成了与 documentation 中完全相同的安装。但是没用。
我遇到了一个错误:
dany@dany1L:~/git/app$ playFramework-2.2.6
[info] Loading project definition from /home/dany/git/app/project
/home/dany/git/app/build.sbt:11: error: not found: value QueryDSLPlugin
val current = project.in(file(".")).configs(QueryDSLPlugin.QueryDSL)
^
[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?
这是我的 project/plugins.sbt:
// Comment to get more information during initialization
logLevel := Level.Warn
// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// Use the Play sbt plugin for Play projects
// changed to support play 2.2.4 addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.6")
addSbtPlugin("com.code-troopers.play" % "play-querydsl" % "0.1.2")
还有我的 build.sbt:
import com.typesafe.config._
import play.Project._
import sbt._
import Keys._
//javacOptions ++= Seq("-Xlint:unchecked")
playJavaSettings
playJavaSettings ++ QueryDSLPlugin.queryDSLSettings
val current = project.in(file(".")).configs(QueryDSLPlugin.QueryDSL)
val conf = ConfigFactory.parseFile(new File("conf/application.conf")).resolve()
name := conf.getString("app.name")
version := conf.getString("app.version")+"_("+conf.getString("app.releaseDate")+")"
libraryDependencies ++= Seq(
javaJdbc,
javaJpa,
"org.hibernate" % "hibernate-entitymanager" % "3.6.9.Final",
"mysql" % "mysql-connector-java" % "5.1.27",
"org.mindrot" % "jbcrypt" % "0.3m",
"org.jasypt" % "jasypt" % "1.9.2",
"org.apache.poi" % "poi" % "3.10.1",
"com.googlecode.genericdao" % "dao" % "1.2.0",
"com.googlecode.genericdao" % "search-jpa-hibernate" % "1.2.0",
"com.google.code.gson" % "gson" % "2.3.1",
"com.googlecode.json-simple" % "json-simple" % "1.1.1",
"javax.mail" % "javax.mail-api" % "1.5.3",
"javax.activation" % "activation" % "1.1.1",
"com.sun.mail" % "javax.mail" % "1.5.3",
"com.querydsl" % "querydsl-jpa" % "4.0.2",
"com.querydsl" % "querydsl-apt" % "4.0.2",
cache
)
请帮帮我
添加后:
import codetroopers._
在 build.sbt
之上我收到一个错误:
[info] Loading project definition from /home/dany/git/app/project
error: bad symbolic reference. A signature in QueryDSLPlugin.class refers to type AutoPlugin
in package sbt which is not available.
It may be completely missing from the current classpath, or the version on
the classpath might be incompatible with the version used when compiling QueryDSLPlugin.class.
[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?
感谢@Nathan 和他的回答 here
经过几天的努力,我终于成功了。
这是我的配置文件:
plugins.sbt
// Comment to get more information during initialization
logLevel := Level.Warn
// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// Use the Play sbt plugin for Play projects
// changed to support play 2.2.4 addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.6")
addSbtPlugin("com.code-troopers.play" % "play-querydsl" % "0.1.1")
和build.sbt
import com.typesafe.config._
import play.Project._
import sbt._
import Keys._
//javacOptions ++= Seq("-Xlint:unchecked")
playJavaSettings
val conf = ConfigFactory.parseFile(new File("conf/application.conf")).resolve()
name := conf.getString("app.name")
version := conf.getString("app.version")+"_("+conf.getString("app.releaseDate")+")"
libraryDependencies ++= Seq(
javaJdbc,
javaJpa,
"org.hibernate" % "hibernate-entitymanager" % "3.6.9.Final",
"mysql" % "mysql-connector-java" % "5.1.27",
"org.mindrot" % "jbcrypt" % "0.3m",
"org.jasypt" % "jasypt" % "1.9.2",
"org.apache.poi" % "poi" % "3.10.1",
"com.googlecode.genericdao" % "dao" % "1.2.0",
"com.googlecode.genericdao" % "search-jpa-hibernate" % "1.2.0",
"com.google.code.gson" % "gson" % "2.3.1",
"com.googlecode.json-simple" % "json-simple" % "1.1.1",
"javax.mail" % "javax.mail-api" % "1.5.3",
"javax.activation" % "activation" % "1.1.1",
"com.sun.mail" % "javax.mail" % "1.5.3",
"com.querydsl" % "querydsl-jpa" % "4.0.2",
"com.querydsl" % "querydsl-apt" % "4.0.2",
cache
)
playJavaSettings ++ QueryDSLPlugin.queryDSLSettings
val current = project.in(file(".")).configs(QueryDSLPlugin.QueryDSL)
QueryDSLPlugin.queryDSLPackage := "models"
和build.properties
sbt.version=0.13.0