我正在从 Activator 2.3.x 升级到 2.4.x(最终升级到 2.5.x)。作为此迁移的一部分,我不能再使用该activator eclipse
命令从 Play 应用程序生成 Eclipse 项目。
我在一个团队中工作,其中一些使用 IntelliJ。所以,我不能为每个项目进行这些更改,因为它对 IntelliJ 用户没有用,并且不适合使用项目源进行版本。
我一直在遵循这些指示。以下是我迄今为止采取的迁移步骤:
- 更改 project/plugins.sbt 以使用 2.4.6
- 在 project/application.conf 中,更改
evolutionplugin=disabled
为play.evolutions.enabled=false
- 在 project/build.sbt 中,
javaEbean
从libraryDependencies
- Eclipse
用户 下载并安装 SBT:http
://www.scala-sbt.org/ - 解压到C:\dev\.sbt\0.13
b。创建 SBT_HOME 环境变量 -SBT_HOME=C:\dev\.sbt\0.13
c。添加%SBT_HOME%\bin
到 -dPATH
。 在- ePATH=...;%SBT_HOME%\bin;
创建“插件”文件夹。在 plugins 目录中创建 plugins.sbt 文件 - f. 将以下行添加到全局 plugins.sbt: - g。编辑以指定 SBT 插件目录: - h。编辑以指定 SBT 引导目录: - i。创建 sbteclipse.sbt 文件%SBT_HOME%
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-dir C:/dev/.sbt/0.13/plugins
%SBT_HOME%\conf\sbtopts
-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 版本一起使用,而不是插件指定并在引导文件夹中提供的版本。