2015-07-03 27 views
1

我有問題,斯卡拉2.10.3和Java 1.7如何在Play 2.2中啓用play-querydsl插件?

我做安裝酷似它在documentation設立querydsl框架中發揮2.2.6。但它不起作用。

我gettign錯誤:

[email protected]:~/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? 
+0

你有沒有試過在build.sbt中導入包'codetroopers'?由於錯誤 –

+0

,我可能需要,因爲在文檔中沒有明確的代碼指令。我怎樣才能做到這一點? '導入QueryDSLPlugin._' dosnt工作 – masterdany88

+0

將import codetroopers._添加到build.sbt的頂部。它可能不是這個,但值得嘗試 –

回答

0

感謝@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 
相關問題