playframework - Generate Eclipse project using SBT -
i'm upgrading activator 2.3.x 2.4.x (and eventually, 2.5.x). part of migration, can no longer use activator eclipse
command generate eclipse project play application.
i work on team, of use intellij. so, cannot make these changes each project, since it'd unuseful intellij users, , it'd inappropriate version project source.
i've been following these instructions. here steps migration i've taken far:
- change project/plugins.sbt use 2.4.6
- in project/application.conf, change
evolutionplugin=disabled
play.evolutions.enabled=false
- in project/build.sbt, remove
javaebean
librarydependencies
- eclipse users
a. download , install sbt: http://www.scala-sbt.org/
- extractc:\dev\.sbt\0.13
b. create sbt_home environment variable -sbt_home=c:\dev\.sbt\0.13
c. add%sbt_home%\bin
path
-path=...;%sbt_home%\bin;
d. create 'plugins' folder @%sbt_home%
-c:\dev\.sbt\0.13\plugins
e. create plugins.sbt file in plugins directory
-c:\dev\.sbt\0.13\plugins\plugins.sbt
f. add following line global plugins.sbt:
-addsbtplugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
g. edit%sbt_home%\conf\sbtopts
specify sbt plugins directory:
--sbt-dir c:/dev/.sbt/0.13/plugins
h. edit%sbt_home%\conf\sbtopts
specify sbt boot directory:
--sbt-boot c:/dev/.sbt/0.13/plugins/boot
i. create sbteclipse.sbt file @%sbt_home%
at point, should able create eclipse project, cannot resolve sbteclipse:
[warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: unresolved dependencies :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: com.typesafe.sbteclipse#sbteclipse-plugin;4.0.0: not found [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] [warn] note: unresolved dependencies have attributes. check these dependencies exist 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 @ sbt.ivyactions$.sbt$ivyactions$$resolve(ivyactions.scala:313) @ sbt.ivyactions$$anonfun$updateeither$1.apply(ivyactions.scala:191) @ sbt.ivyactions$$anonfun$updateeither$1.apply(ivyactions.scala:168) @ sbt.ivysbt$module$$anonfun$withmodule$1.apply(ivy.scala:156) @ sbt.ivysbt$module$$anonfun$withmodule$1.apply(ivy.scala:156) @ sbt.ivysbt$$anonfun$withivy$1.apply(ivy.scala:133) @ sbt.ivysbt.sbt$ivysbt$$action$1(ivy.scala:57) @ sbt.ivysbt$$anon$4.call(ivy.scala:65) @ xsbt.boot.locks$globallock.withchannel$1(locks.scala:93) @ xsbt.boot.locks$globallock.xsbt$boot$locks$globallock$$withchannelretries$1(locks.scala:78) @ xsbt.boot.locks$globallock$$anonfun$withfilelock$1.apply(locks.scala:97) @ xsbt.boot.using$.withresource(using.scala:10) @ xsbt.boot.using$.apply(using.scala:9) @ xsbt.boot.locks$globallock.ignoringdeadlockavoided(locks.scala:58) @ xsbt.boot.locks$globallock.withlock(locks.scala:48) @ xsbt.boot.locks$.apply0(locks.scala:31) @ xsbt.boot.locks$.apply(locks.scala:28) @ sbt.ivysbt.withdefaultlogger(ivy.scala:65) @ sbt.ivysbt.withivy(ivy.scala:128) @ sbt.ivysbt.withivy(ivy.scala:125) @ sbt.ivysbt$module.withmodule(ivy.scala:156) @ sbt.ivyactions$.updateeither(ivyactions.scala:168) @ sbt.classpaths$$anonfun$sbt$classpaths$$work$1$1.apply(defaults.scala:1439) @ sbt.classpaths$$anonfun$sbt$classpaths$$work$1$1.apply(defaults.scala:1435) @ sbt.classpaths$$anonfun$dowork$1$1$$anonfun$90.apply(defaults.scala:1470) @ sbt.classpaths$$anonfun$dowork$1$1$$anonfun$90.apply(defaults.scala:1468) @ sbt.tracked$$anonfun$lastoutput$1.apply(tracked.scala:37) @ sbt.classpaths$$anonfun$dowork$1$1.apply(defaults.scala:1473) @ sbt.classpaths$$anonfun$dowork$1$1.apply(defaults.scala:1467) @ sbt.tracked$$anonfun$inputchanged$1.apply(tracked.scala:60) @ sbt.classpaths$.cachedupdate(defaults.scala:1490) @ sbt.classpaths$$anonfun$updatetask$1.apply(defaults.scala:1417) @ sbt.classpaths$$anonfun$updatetask$1.apply(defaults.scala:1369) @ scala.function1$$anonfun$compose$1.apply(function1.scala:47) @ sbt.$tilde$greater$$anonfun$$u2219$1.apply(typefunctions.scala:40) @ sbt.std.transform$$anon$4.work(system.scala:63) @ sbt.execute$$anonfun$submit$1$$anonfun$apply$1.apply(execute.scala:228) @ sbt.execute$$anonfun$submit$1$$anonfun$apply$1.apply(execute.scala:228) @ sbt.errorhandling$.wideconvert(errorhandling.scala:17) @ sbt.execute.work(execute.scala:237) @ sbt.execute$$anonfun$submit$1.apply(execute.scala:228) @ sbt.execute$$anonfun$submit$1.apply(execute.scala:228) @ sbt.concurrentrestrictions$$anon$4$$anonfun$1.apply(concurrentrestrictions.scala:159) @ sbt.completionservice$$anon$2.call(completionservice.scala:28) @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.executors$runnableadapter.call(executors.java:511) @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) [error] (*:update) sbt.resolveexception: unresolved dependency: com.typesafe.sbteclipse#sbteclipse-plugin;4.0.0: not found [error] not create eclipse project files: [error] error evaluating task 'scalacoptions': error [error] error evaluating task 'externaldependencyclasspath': error
so, can see steps outlined above, i'm trying allow eclipse users create projects play services. downloaded sbt, extracted dev folder, , started making global changes there.
contents of c:\dev\.sbt\0.13\plugins\plugins.sbt
:
// support play in eclipse addsbtplugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
contents of c:\dev\.sbt\0.13\sbteclipse.sbt
:
import com.typesafe.sbteclipse.plugin.eclipseplugin.eclipsekeys // download source , javadocs binaries eclipsekeys.withsource := true eclipsekeys.withjavadoc := true // compile project before generating eclipse files, generated .scala or .class files views , routes 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 views , routes eclipsekeys.createsrc := eclipsecreatesrc.valueset(eclipsecreatesrc.managedclasses, eclipsecreatesrc.managedresources)
contents of c:\dev\.sbt\0.13\conf\sbtopts
:
# ------------------------------------------------ # # sbt configuration file. # # ------------------------------------------------ # # disable ansi color codes # #-no-colors # starts sbt if current directory contains no sbt project. # -sbt-create # path global settings/plugins directory (default: ~/.sbt) # #-sbt-dir /etc/sbt -sbt-dir c:/dev/.sbt/0.13/plugins # path shared boot directory (default: ~/.sbt/boot in 0.11 series) # -sbt-boot c:/dev/.sbt/0.13/plugins/boot # path local ivy repository (default: ~/.ivy2) # #-ivy ~/.ivy2 # set memory options # #-mem <integer> # use local caches projects, no sharing. # #-no-share # put sbt in offline mode. # #-offline # sets sbt version use. #-sbt-version 0.11.3 # scala version (default: latest release) # #-scala-home <path> #-scala-version <version> # java version (default: java path, $(java -version |& grep version)) # #-java-home <path>
project exists @ c:\dev\eclipse\workspaces\company\project
. in cygwin, navigate location , execute sbt eclipse
(or activator eclipse
, has same outcome), according understanding should work. but, said, error, , doesn't work.
can me set correctly can create eclipse project files play service, , continue on happy lil migration journey?
i think sbteclipse plugin trying pulled in system's version of scala, instead of version specified plugin , provided in boot folder.
i did migration play 2.4 play 2.5 , described whole procedure in this post. in another post can find how "eclipcify" project.
i did not pay attention, use global sbt settings. global sbt settings:
create c:\dev\.sbt\0.13\plugins\plugins.sbt content:
//support play in eclipse addsbtplugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
create c:\dev\.sbt\sbteclipse.sbt content:
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 views , routes eclipsekeys.createsrc := eclipsecreatesrc.valueset(eclipsecreatesrc.managedclasses, eclipsecreatesrc.managedresources)
note: in case instead of dev user root directory.
the project 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" @ "file:///"+path.userhome.absolutepath+"/.m2/repository" librarydependencies ++= seq(javajdbc, cache, javaws)
note: used scalaversion := 2.11.7, since generated value, test put 2.11.8. works both of them.
i not have more: no sbt options, sbt home in environment variables (just in post).
the bottom line: did items 1,2,3 things working.