在ebeans

时间:2017-04-05 09:19:28

标签: java sbt ebean playframework-2.5

我在尝试运行应用程序时遇到了一个奇怪的错误。在这种情况下,我有一个项目(让我们称之为项目A),其中包含在第二个项目(项目B)中引用的实体。为了防止重复工作,将项目A中引用的实体捆绑到jar(称之为project_a_models.jar),然后将其放入项目B的lib文件夹中并运行应用程序并获取以下内容

[info] Compiling 12 Scala sources and 31 Java sources to /mnt/Storage1/Projects/kodi/target/scala-2.11/classes...
[error] /mnt/Storage1/Projects/kodi/app/controllers/KodiController.java:18: cannot access com.avaje.ebean.bean.EntityBean
[error]   class file for com.avaje.ebean.bean.EntityBean not found
[error]         List<PersonRole> personRoles = (List<PersonRole>) Secured.getPerson(ctx()).getRoles();
[info] /mnt/Storage1/Projects/kodi/app/util/Util.java: /mnt/Storage1/Projects/kodi/app/util/Util.java uses or overrides a deprecated API.
[info] /mnt/Storage1/Projects/kodi/app/util/Util.java: Recompile with -Xlint:deprecation for details.
[error] (compile:compileIncremental) javac returned nonzero exit code
[info] Compiling 12 Scala sources and 31 Java sources to /mnt/Storage1/Projects/kodi/target/scala-2.11/classes...
[error] /mnt/Storage1/Projects/kodi/app/controllers/KodiController.java:18: cannot access com.avaje.ebean.bean.EntityBean
[error]   class file for com.avaje.ebean.bean.EntityBean not found
[error]         List<PersonRole> personRoles = (List<PersonRole>) Secured.getPerson(ctx()).getRoles();
[info] /mnt/Storage1/Projects/kodi/app/util/Util.java: /mnt/Storage1/Projects/kodi/app/util/Util.java uses or overrides a deprecated API.
[info] /mnt/Storage1/Projects/kodi/app/util/Util.java: Recompile with -Xlint:deprecation for details.
[error] (compile:compileIncremental) javac returned nonzero exit code
[info] Compiling 12 Scala sources and 31 Java sources to /mnt/Storage1/Projects/kodi/target/scala-2.11/classes...
[error] /mnt/Storage1/Projects/kodi/app/controllers/KodiController.java:18: cannot access com.avaje.ebean.bean.EntityBean
[error]   class file for com.avaje.ebean.bean.EntityBean not found
[error]         List<PersonRole> personRoles = (List<PersonRole>) Secured.getPerson(ctx()).getRoles();
[info] /mnt/Storage1/Projects/kodi/app/util/Util.java: /mnt/Storage1/Projects/kodi/app/util/Util.java uses or overrides a deprecated API.
[info] /mnt/Storage1/Projects/kodi/app/util/Util.java: Recompile with -Xlint:deprecation for details.
[error] (compile:compileIncremental) javac returned nonzero exit code
[error] application - 

Person和PersonRole是项目A中用于项目B的实体。 从编译错误中可以看出,它引用了'com.avaje.ebean.bean.EntityBean'而不是io.ebean版本。 我正在使用Play 2.5和ebeans来运行这两个应用程序,并在他们的plugins中有以下内容.bt

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.12")

// Web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.4")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.8")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")
addSbtPlugin("org.irundaia.sbt" % "sbt-sassify" % "1.4.6")
addSbtPlugin("io.teamscala.sbt" % "sbt-babel" % "1.0.5")

//addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.0")
//addSbtPlugin("com.github.stonexx.sbt" % "sbt-babeljs" % "1.0.5")

// Play enhancer - this automatically generates getters/setters for public fields
// and rewrites accessors of these fields to use the getters/setters. Remove this
// plugin if you prefer not to have this feature, or disable on a per project
// basis using disablePlugins(PlayEnhancer) in your build.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")

// Play Ebean support, to enable, uncomment this line, and enable in your build.sbt using
// enablePlugins(PlayEbean).
 addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "4.0.0-M2")

//sbt plugin for eclipse
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.1.0")

这在他们的build.sbt中(它们大致相似)

name := "Project_A"
version := "1.0"

lazy val root = (project in file(".")).enablePlugins(PlayJava, SbtWeb, PlayEbean)

scalaVersion := "2.11.8"

JsEngineKeys.engineType := JsEngineKeys.EngineType.Node

libraryDependencies ++= Seq(
  javaJdbc,
  cache,
  javaWs,
  "mysql" % "mysql-connector-java" % "5.1.27",
  "commons-io" % "commons-io" % "2.5" withSources(),
  "org.webjars" %% "webjars-play" % "2.5.0-4",
  "org.webjars" % "react" % "15.3.1",
  "org.webjars.npm" % "react-dom" % "15.0.1",
  "org.apache.poi" % "poi" % "3.14",
  "org.apache.poi" % "poi-ooxml" % "3.14",
  "org.webjars" % "jquery" % "3.1.0",
  "org.apache.pdfbox" % "pdfbox" % "2.0.3",
  "org.webjars" % "highcharts" % "4.2.5",
  "org.webjars" % "material-design-icons" % "3.0.0",
  evolutions,
  "javax.mail" % "mail" % "1.4.7",
  "be.objectify" %% "deadbolt-java" % "2.5.3"
)

resolvers += Resolver.url("Typesafe Ivy releases", url("https://repo.typesafe.com/typesafe/ivy-releases"))(Resolver.ivyStylePatterns)

fork in run := false

所以我的问题是,'com.avaje.ebean.bean.EntityBean'的引用来自哪里?有没有办法清理我的依赖项和插件,以确保正在使用正确的ebeans版本?任何见解都会非常有用。

0 个答案:

没有答案