我正在从Activator 2.3.x升级到2.4.x(最终升级到2.5.x)。作为此迁移的一部分,我不能再使用activator eclipse
命令从Play应用程序生成Eclipse项目。
我在一个团队工作,其中一些团队使用IntelliJ。因此,我不能对每个项目进行这些更改,因为它对IntelliJ用户来说是不可用的,并且使用项目源进行版本化是不合适的。
我一直在关注these条款。以下是我到目前为止所采取的迁移步骤:
evolutionplugin=disabled
更改为play.evolutions.enabled=false
javaEbean
libraryDependencies
C:\dev\.sbt\0.13
SBT_HOME=C:\dev\.sbt\0.13
%SBT_HOME%\bin
添加到PATH
PATH=...;%SBT_HOME%\bin;
%SBT_HOME%
创建'plugins'文件夹
- C:\dev\.sbt\0.13\plugins
C:\dev\.sbt\0.13\plugins\plugins.sbt
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
%SBT_HOME%\conf\sbtopts
以指定SBT插件目录:-sbt-dir C:/dev/.sbt/0.13/plugins
%SBT_HOME%\conf\sbtopts
以指定SBT启动目录:-sbt-boot C:/dev/.sbt/0.13/plugins/boot
%SBT_HOME%
此时,我应该能够创建一个Eclipse项目,但它无法解析sbteclipse:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.typesafe.sbteclipse#sbteclipse-plugin;4.0.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] com.typesafe.sbteclipse:sbteclipse-plugin:4.0.0 (scalaVersion=2.11, sbtVersion=0.13)
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.typesafe.sbteclipse:sbteclipse-plugin:4.0.0 (scalaVersion=2.11, sbtVersion=0.13) (C:\dev\.sbt\0.13\plugins\plugins.sbt#L2-3)
[warn] +- gateway-api:gateway-api_2.11:1.0-SNAPSHOT
sbt.ResolveException: unresolved dependency: com.typesafe.sbteclipse#sbteclipse-plugin;4.0.0: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:313)
at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:191)
at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:168)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:156)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:156)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:133)
at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57)
at sbt.IvySbt$$anon$4.call(Ivy.scala:65)
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
at xsbt.boot.Using$.withResource(Using.scala:10)
at xsbt.boot.Using$.apply(Using.scala:9)
at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
at xsbt.boot.Locks$.apply0(Locks.scala:31)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at sbt.IvySbt.withDefaultLogger(Ivy.scala:65)
at sbt.IvySbt.withIvy(Ivy.scala:128)
at sbt.IvySbt.withIvy(Ivy.scala:125)
at sbt.IvySbt$Module.withModule(Ivy.scala:156)
at sbt.IvyActions$.updateEither(IvyActions.scala:168)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1439)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1435)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$90.apply(Defaults.scala:1470)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$90.apply(Defaults.scala:1468)
at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:37)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1473)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1467)
at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:60)
at sbt.Classpaths$.cachedUpdate(Defaults.scala:1490)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1417)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1369)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] (*:update) sbt.ResolveException: unresolved dependency: com.typesafe.sbteclipse#sbteclipse-plugin;4.0.0: not found
[error] Could not create Eclipse project files:
[error] Error evaluating task 'scalacOptions': error
[error] Error evaluating task 'externalDependencyClasspath': error
因此,您可以从上面列出的步骤中看到,我正在尝试允许Eclipse用户从Play服务创建项目。我下载了SBT,将其解压缩到我的dev文件夹,然后开始在那里进行全局更改。
C:\dev\.sbt\0.13\plugins\plugins.sbt
的内容:
// Support Play in Eclipse
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
C:\dev\.sbt\0.13\sbteclipse.sbt
的内容:
import com.typesafe.sbteclipse.plugin.EclipsePlugin.EclipseKeys
// Download Source and Javadocs with binaries
EclipseKeys.withSource := true
EclipseKeys.withJavadoc := true
// 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)
// Java project. Don't expect Scala IDE
EclipseKeys.projectFlavor := EclipseProjectFlavor.Java
// Use .class files instead of generated .scala files for views and routes
EclipseKeys.createSrc := EclipseCreateSrc.ValueSet(EclipseCreateSrc.ManagedClasses, EclipseCreateSrc.ManagedResources)
C:\dev\.sbt\0.13\conf\sbtopts
的内容:
# ------------------------------------------------ #
# The SBT Configuration file. #
# ------------------------------------------------ #
# Disable ANSI color codes
#
#-no-colors
# Starts sbt even if the current directory contains no sbt project.
#
-sbt-create
# Path to global settings/plugins directory (default: ~/.sbt)
#
#-sbt-dir /etc/sbt
-sbt-dir C:/dev/.sbt/0.13/plugins
# Path to shared boot directory (default: ~/.sbt/boot in 0.11 series)
#
-sbt-boot C:/dev/.sbt/0.13/plugins/boot
# Path to local Ivy repository (default: ~/.ivy2)
#
#-ivy ~/.ivy2
# set memory options
#
#-mem <integer>
# Use local caches for projects, no sharing.
#
#-no-share
# Put SBT in offline mode.
#
#-offline
# Sets the SBT version to use.
#-sbt-version 0.11.3
# Scala version (default: latest release)
#
#-scala-home <path>
#-scala-version <version>
# java version (default: java from PATH, currently $(java -version |& grep version))
#
#-java-home <path>
项目位于C:\dev\eclipse\workspaces\company\project
。在Cygwin中,我导航到该位置并执行sbt eclipse
(或activator eclipse
,其具有相同的结果),根据我的理解,这应该起作用。但是,就像我说的那样,我得到一个错误,但它不起作用。
有人可以帮我正确设置这个设置,以便我可以为Play服务创建Eclipse项目文件,并继续我快乐的lil迁移之旅吗?
我认为sbteclipse插件试图使用我的系统版本的scala,而不是插件指定的版本并在boot文件夹中提供。
答案 0 :(得分:0)
我最近从Play 2.4迁移到Play 2.5,并在this post中描述了整个过程。在another post中,您可以找到如何&#34; eclipcify&#34;该项目。
我没注意,你使用全局sbt设置。 对于全局sbt设置:
使用内容创建c:\ dev \ .sbt \ 0.13 \ plugins \ plugins.sbt:
//Support Play in Eclipse
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
使用内容创建C:\ dev \ .sbt \ sbteclipse.sbt:
import com.typesafe.sbteclipse.plugin.EclipsePlugin.EclipseKeys
EclipseKeys.preTasks := Seq(compile in Compile)
EclipseKeys.withSource := true
EclipseKeys.withJavadoc := true
// Java project. Don't expect Scala IDE
EclipseKeys.projectFlavor := EclipseProjectFlavor.Java
// Use .class files instead of generated .scala files for views and routes
EclipseKeys.createSrc := EclipseCreateSrc.ValueSet(EclipseCreateSrc.ManagedClasses, EclipseCreateSrc.ManagedResources)
注意:在我的情况下,而不是 dev 是我的用户根目录。
项目build.sbt:
import NativePackagerHelper._
name := """play-server-example"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.8"
resolvers += "Local Maven Repository" at "file:///"+Path.userHome.absolutePath+"/.m2/repository"
libraryDependencies ++= Seq(javaJdbc, cache, javaWs)
注意:最初我使用scalaVersion:= 2.11.7,因为这是生成的值,但是对于测试我放了2.11.8。这适用于他们两个。
我没有更多的东西:没有sbt选项,只有sbt home在环境变量中(就像在我的帖子中一样)。
底线:我只做了第1,2,3项,以确保工作正常。