• scala-eclipse


    本篇两部分:

    1,windows下scala的eclipse开发环境

    2,在maven项目中使用scala

    1,windows下scala的eclipse开发环境

    步骤:

    1,下载并安装scala,最新版

    Download Previous Versions | The Scala Programming Language

    http://www.scala-lang.org/download/all.html

    2,eclipse开发环境搭建

    先说结论:最简单的方法,下载Scala IDE for Eclipse官网提供的集成scalaeclipse

    下载页面:

    Download Scala IDE for Eclipse - Scala IDE for Eclipse

    http://scala-ide.org/download/sdk.html#

     

    建立scala项目

     

    再说走过的晚路:

    安装方法:

    步骤1

    步骤2

     

    步骤3

     

     

    卸载方法:

    问题

    按照上面的方法安装重启eclipse出现:

    org.osgi.framework.BundleException: Could not resolve module: org.scalaide.worksheet [878]

      Unresolved requirement: Import-Package: scala.tools.eclipse.semantichighlighting

        -> Export-Package: scala.tools.eclipse.semantichighlighting; bundle-version="3.0.4.v-2_11-201407232043-c46f499"; bundle-symbolic-name="org.scala-ide.sdt.core";

     

    version="0.0.0"

           org.scala-ide.sdt.core [869]

             No resolution report for the bundle.  Unresolved requirement: Import-Package: scala.tools.eclipse; apply-aspects:="false"

        -> Export-Package: scala.tools.eclipse; bundle-version="3.0.4.v-2_11-201407232043-c46f499"; bundle-symbolic-name="org.scala-ide.sdt.core"; version="0.0.0"

      Unresolved requirement: Require-Bundle: org.scala-ide.sdt.core; bundle-version="[3.0.4.v-2_11-201407232043-c46f499,3.0.4.v-2_11-201407232043-c46f499]"

        -> Bundle-SymbolicName: org.scala-ide.sdt.core; bundle-version="3.0.4.v-2_11-201407232043-c46f499"; singleton:="true"

      Bundle was not resolved because of a uses contraint violation.

      org.osgi.service.resolver.ResolutionException: Uses constraint violation. Unable to resolve resource org.scalaide.worksheet [osgi.identity;

     

    osgi.identity="org.scalaide.worksheet"; type="osgi.bundle"; version:Version="0.2.3.v-2_11-201407232049-4f7988d"; singleton:="true"] because it is exposed to package

     

    'javax.xml.bind' from resources org.eclipse.osgi [osgi.identity; osgi.identity="org.eclipse.osgi"; type="osgi.bundle"; version:Version="3.10.0.v20140606-1445";

     

    singleton:="true"] and javax.xml.bind [osgi.identity; osgi.identity="javax.xml.bind"; type="osgi.bundle"; version:Version="2.1.9.v201005080401"] via two dependency

     

    chains.

     

    Chain 1:

      org.scalaide.worksheet [osgi.identity; osgi.identity="org.scalaide.worksheet"; type="osgi.bundle"; version:Version="0.2.3.v-2_11-201407232049-4f7988d";

     

    singleton:="true"]

        require: (osgi.wiring.bundle=org.eclipse.core.runtime)

         |

        provide: osgi.wiring.bundle: org.eclipse.core.runtime

      org.eclipse.osgi [osgi.identity; osgi.identity="org.eclipse.osgi"; type="osgi.bundle"; version:Version="3.10.0.v20140606-1445"; singleton:="true"]

     

    Chain 2:

      org.scalaide.worksheet [osgi.identity; osgi.identity="org.scalaide.worksheet"; type="osgi.bundle"; version:Version="0.2.3.v-2_11-201407232049-4f7988d";

     

    singleton:="true"]

        require: (osgi.wiring.bundle=org.scala-ide.sbt.full.library)

         |

        provide: osgi.wiring.bundle; osgi.wiring.bundle="org.scala-ide.sbt.full.library"; bundle-version:Version="0.13.2.v-2_11-20140723-2242"

      org.scala-ide.sbt.full.library [osgi.identity; osgi.identity="org.scala-ide.sbt.full.library"; type="osgi.bundle"; version:Version="0.13.2.v-2_11-20140723-2242"]

        import: (osgi.wiring.package=javax.xml.bind)

         |

        export: osgi.wiring.package: javax.xml.bind

      javax.xml.bind [osgi.identity; osgi.identity="javax.xml.bind"; type="osgi.bundle"; version:Version="2.1.9.v201005080401"]

             at org.eclipse.osgi.container.Module.start(Module.java:434)

             at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)

             at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561)

             at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)

             at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)

             at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)

             at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)

             at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

    原因

    eclipse Luna4.4版本比较新,参考官方文档的解释是不兼容。

    Scala IDE for Eclipse官网在安装需求中说支持3.7,4.2

    参考:

    官方文档eclipsejdkscala版本选择说的很清楚。

    Getting Started — Scala IDE 0.1-SNAPSHOT documentation

    http://scala-ide.org/docs/current-user-doc/gettingstarted/index.html

     

    常见问题:

    Frequently Asked Questions — Scala IDE 0.1-SNAPSHOT documentation

    http://scala-ide.org/docs/user/faq.html

     

    版本代号 平台版本 主要版本发行日期 SR1发行日期 SR2发行日期

    Callisto 3.2 2006626 N/A N/A

    Europa 3.3 2007627 2007928 2008229

    Ganymede 3.4 2008625 2008924 2009225

    Galileo 3.5 2009624 2009925 2010226

    Helios 3.6 2010623 2010924 2011225

    Indigo 3.7 2011622 2011923 2012224

    Juno 3.84.2 2012627 2012928 201331

    Kepler 4.3 2013626 2013927 2014228

    Luna 4.4 2014625 N/A N/A

     

    选择个能用的eclipse

    Eclipse downloads - mirror selection

    http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/juno/SR2/eclipse-jee-juno-SR2-win32-x86_64.zip

    还是直接下载集成scala的吧!

    直接就能在eclipse运行,连scala本身都不用下载安装了。

     

    2,在maven项目中使用scala

    注意:spark和scala的兼容问题。spark1.5.2的源代码需要在scala2.11下重新编译。

    如果不愿重新编译,

     

     





  • 相关阅读:
    3星|《全球电商进化史》:全球电商亲历记
    2星|陈春花《共生》:逻辑差语文差缺证据。不敢相信知名商学院教授的书居然这么差
    3星|《第五次开始》:考古学家写的人类简史与未来简史
    4星|《财经》2018年第21期:互联网处方能解决药品质量和价格问题
    2.5星|托夫勒《权力的转移》;30年旧书,现在看理论有点牵强肤浅,预测有的准有的不准
    2018左其盛好书榜(截至9月15日)
    沟通交流技巧相关的11本书点评
    没睡好觉的上级更容易辱骂下属:3.5星|《哈佛商业评论》第9期
    3星|《利润模式》:20年旧书,30种模式
    在 C# 中通过 P/Invoke 调用Win32 DLL
  • 原文地址:https://www.cnblogs.com/xfly/p/4117638.html
Copyright © 2020-2023  润新知