如何在Play 2.2中启用play-querydsl插件?

时间:2015-07-03 10:41:29

标签: playframework-2.2 querydsl

我在使用scala 2.10.3和java 1.7在play 2.2.6中设置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? 

这是我的项目/ 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? 

1 个答案:

答案 0 :(得分:0)

感谢@Nathan 和他的回答here

经过几天的努力,我终于努力了。

以下是我的配置文件:

<强> plugins.sbt

if (input.search(/^[1-5](\.[1-5])?$/)==-1)
{
    //flag an error message and don't change DOM element
}

build.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.properties

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"