Scala IDE:方法XXXX定义了两个源自文件的冲突符号

时间:2017-01-19 18:45:36

标签: scala scala-ide

我刚刚下载了Scala eclipse IDE,但导入项目后出现了一些错误

method getTableConfig is defined twice conflicting symbols both originated in file '....'

以下是示例代码,弹出此错误的任何原因 - 代码已成功编译,但

package com.mavencode.app.config

import java.io.{BufferedReader, File, InputStream, InputStreamReader}

import ...

object ConfigUtil
{
  def getTableConfig(configKey:String) (implicit config: Config) : ConnectionConfig = {
    val report: Config = config.getConfig(s"tables.$configKey")
    val db: Config = config.getConfig(s"db.${report.getString("db")}")
    ConnectionConfig(
      db.getString("host"),
      db.getInt("port"),
      db.getString("database"),
      similarity.getString("table"),
      db.getString("user"),
      db.getString("password"),
      report.getInt("lowerBound"),
      report.getInt("upperBound"),
      report.getInt("numPartitions")
    )
  }

2 个答案:

答案 0 :(得分:2)

我认为这是我下载的最新版Scala IDE中的一个错误,我在较旧的scala IDE上打开了我的项目并且工作正常

此版本的错误

Scala IDE build of Eclipse SDK
Build id: 4.5.0-vfinal-2016-12-13T10:59:29Z-Typesafe

使用旧版本

Scala IDE build of Eclipse SDK
Build id: 4.4.1-vfinal-2016-05-04T11:16:00Z-Typesafe

答案 1 :(得分:0)

Scala-ide附带了一个Scala项目创建向导。这对SBT来说效果不佳。如果您使用SBT,最好自己创建Scala项目。你可以使用Giter8。以下是Giter8模板:

https://github.com/foundweekends/giter8/wiki/giter8-templates

然后使用Sbt Eclipse插件生成Eclipse项目:

https://github.com/typesafehub/sbteclipse

运行

sbt eclipse

将现有项目导入Eclipse

以下是该流程的更详细说明:

http://www.nodalpoint.com/development-and-deployment-of-spark-applications-with-scala-eclipse-and-sbt-part-1-installation-configuration/